	
	/*
 
    Project: Can Citizen Pressure Be Induced to Improve Public Service Provision?
    Activity: Replication dofiles
    Time: July 2024
    Purpose: Replicating tables and figures 
	
    */
	
    ***********************
    *** 1) INITIALIZING ***		
    ***********************

    clear all
    set more off
    pause on
    log close _all
    set maxvar 32000
	set mem 1500m
	set matsize 2000
	version 14
	
    *************************************************
	*** 2) SET MAIN WORKING DIRECTORY AND GLOBALS ***		
	*************************************************
 	
	* Set CD and global

	if c(username) == "" { // indicate user name
		global main "" // indicate folder
		global usedata "$main/2.Datasets/"
		global logs "$main/4.Logs/"
		global Figures "$main/3.Tables and Figures/Figures"
		global tables "$main/3.Tables and Figures/Tables"
	}
				
	
	else if "`c(username)'" == "" {
		
		}

	
	* Setting the log
	
	cap log close
	log using "${logs}analysis_outcome.smcl", replace
	
	******************************************************
	* Setting up control vector and local for regression *
	******************************************************
	
	* This section creates locals that will be used during the analysis.
	
	*******************************************
	** Control vector and treatment variable **
	*******************************************
	
	* Following the PAP, we need to set the following control variables
	
		** An indicator variable taking the value 1 if a health center is a HCII
		** An indicator variable for whether the facility provides official delivery services
		** An indicator variable for whether a health center has staff houses
		** Whether household members report having used this health facility within the 12 months prior to the baseline
		** Average education level of the female head of household in health center catchment area, measured in years of education
		** Average household wealth level in the health center catchment area, calculated as the first component of a principal component analysis of the number of items of 17 assets (including cattle, radios, bicycles etc.) owned by the household.
		
	**************************************************
	** Indices corresponds to the 4 main indicators **
	**************************************************
	
	* We have different components
			* values of our utilization rate: _urate_z
			* treatment quality: _treatqual_z
			* patient satisfaction: _patsat_z
			* health outcome: _healthout_z
			* mortality outcome: _mortrate_05
	
	* We create it for endline, midline and baseline and one only irrespective to the timeline
	
	local e_indices e_urate_z e_treatqual_z e_patsat_z 
	local m_indices m_urate_z m_treatqual_z m_patsat_z 
	local b_indices b_urate_z b_treatqual_z b_patsat_z
	local bm_indices bm_urate_z bm_treatqual_z bm_patsat_z

	local e_indices_ho e_healthout_z
	local m_indices_ho m_healthout_z
	local b_indices_ho b_healthout_z
	local bm_indices_ho bm_healthout_z
	
	local e_indices_hc e_mortrate_05
	local m_indices_hc m_mortrate_05
	local b_indices_hc b_mortrate_05
	local bm_indices_hc bm_mortrate_05
	
	local indices urate_z treatqual_z patsat_z commtg_z
	local indices_ho healthout_z
	local indices_hc mortrate_05 h_ctzpressure_z
	
	local keep
	
	foreach var in e m b bm {
	local keep `keep' ``var'_indices' ``var'_indices_ho' ``var'_indices_hc' 
	}
	**********************
	** Index components **
	**********************
	
	* Main indices
	
	***************
	* Utilization *
	***************
	
	* As we will regress the utilization rate over its non-standardized index components, we need to create a local
	
	*_ns stands for non-standardized and consists of non-standardized index components
	
	* We create local for utilization index without prefix
	
	local utilization urate_z hf_otherpract_z visit_hf_z
	local utilization_ns urate_z hf_otherpract visit_hf
	
	local utilization_vacc immunization_z
	local utilization_vacc_ns immunization
	
	* We create local for utilization index with prefix
	
	local b_utilization b_urate_z b_hf_otherpract_z b_visit_hf_z
	local b_utilization_ns b_urate_z b_hf_otherpract b_visit_hf
	
	local m_utilization m_urate_z m_hf_otherpract_z m_visit_hf_z
	local m_utilization_ns m_urate_z m_visit_hf m_hf_otherpract
	
	local e_utilization e_urate_z e_hf_otherpract_z e_visit_hf_z
	local e_utilization_ns e_urate_z e_hf_otherpract e_visit_hf
	
	foreach var in e m b {
	local keep `keep' ``var'_utilization' ``var'_utilization_ns' 
	}
	
	*********************
	* Treatment quality *
	*********************
	
	* As we will regress the treatment quality over its non-standardized index components, we need to create a local
	
	*_ns stands for non-standardized and consists of non-standardized index components
	
	* We create local for treatment quality index without prefix
	
	local treatmentqual treatqual_z use_equip_z tot_wait_z trained_z exam_privacy_z taketest_z diagnosis_explained_z 
	local treatmentqual_hclevel h_percentstaff_sv_z h_cleanliness_z h_meanstock_z
	local treatmentqual_ns treatqual_z use_equip tot_wait trained exam_privacy taketest diagnosis_explained 
	local treatmentqual_hclevel_ns h_percentstaff_sv h_cleanliness h_meanstock
	
	* We create local for treatment quality index with prefix
	
	local b_treatmentqual b_treatqual_z b_use_equip_z b_tot_wait_z b_trained_z b_exam_privacy_z b_taketest_z b_diagnosis_explained_z b_h_percentstaff_sv_z b_h_cleanliness_z b_h_meanstock_z
	local b_treatmentqual_ns b_treatqual_z b_use_equip b_tot_wait b_trained b_exam_privacy b_taketest b_diagnosis_explained b_h_percentstaff_sv b_h_cleanliness b_h_meanstock
	
	local m_treatmentqual m_treatqual_z m_use_equip_z m_tot_wait_z m_trained_z m_exam_privacy_z m_taketest_z m_diagnosis_explained_z m_h_percentstaff_sv_z m_h_cleanliness_z m_h_meanstock_z
	local m_treatmentqual_ns m_treatqual_z m_use_equip m_tot_wait m_trained m_exam_privacy m_taketest m_diagnosis_explained m_h_percentstaff_sv m_h_cleanliness m_h_meanstock
	
	local e_treatmentqual e_treatqual_z e_use_equip_z e_tot_wait_z e_trained_z e_exam_privacy_z e_taketest_z e_diagnosis_explained_z e_h_percentstaff_sv_z e_h_cleanliness_z e_h_meanstock_z
	local e_treatmentqual_ns e_treatqual_z e_use_equip e_tot_wait e_trained e_exam_privacy e_taketest e_diagnosis_explained e_h_percentstaff_sv e_h_cleanliness e_h_meanstock
	
	************************
	* Patient satisfaction *
	************************
	
	* As we will regress the patient satisfaction over its non-standardized index components, we need to create a local
	
	*_ns stands for non-standardized and consists of non-standardized index components
	
	* We create local for patient satisfaction index without prefix
	
	local patsat patsat_z qualitycare_z politestaff_z interest_health_z stafflistening_z freeexpress_z yearb_avail_z
	local patsat_ns patsat_z qualitycare politestaff interest_health stafflistening freeexpress yearb_avail
	
	local patsat_nobaseline qualityhc_d_z
	local patsat_nobaseline_ns qualityhc_d
	
	* We create local for treatment quality index with prefix
	
	local b_patsat b_patsat_z b_qualitycare_z b_politestaff_z b_interest_health_z b_stafflistening_z b_freeexpress_z b_yearb_avail_z
	local b_patsat_ns b_patsat_z b_qualitycare b_politestaff b_interest_health b_stafflistening b_freeexpress b_yearb_avail
	
	local m_patsat m_patsat_z m_qualityhc_d_z m_qualitycare_z m_politestaff_z m_interest_health_z m_stafflistening_z m_freeexpress_z m_yearb_avail_z
	local m_patsat_ns m_patsat_z m_qualityhc_d m_qualitycare m_politestaff m_interest_health m_stafflistening m_freeexpress m_yearb_avail
	
	local e_patsat e_patsat_z e_qualityhc_d_z e_qualitycare_z e_politestaff_z e_interest_health_z e_stafflistening_z e_freeexpress_z e_yearb_avail_z
	local e_patsat_ns e_patsat_z e_qualityhc_d e_qualitycare e_politestaff e_interest_health e_stafflistening e_freeexpress e_yearb_avail
		
	*******************
	* Health outcomes *
	*******************
	
	* As we will regress the health outcome over its non-standardized index components, we need to create a local
	
	*_ns stands for non-standardized and consists of non-standardized index components
	
	* We create local for Health outcomes index without prefix
	
	local healthoutcomes_ho healthout_z 
	local healthoutcomes_ho_ns healthout_z 
	
	local healthoutcomes_ho18m weight_18m_z muac_18m_z
	local healthoutcomes_ho18m_ns weight_18m muac_18m
	
	local healthoutcomes_ho36m weight_36m_z muac_36m_z
	local healthoutcomes_ho36m_ns weight_36m muac_36m
	
	* We create local for Health outcomes index with prefix
	
	local b_healthoutcomes b_healthout_z b_weight_18m_z b_weight_36m_z b_muac_18m_z b_muac_36m_z 
	local b_healthoutcomes_ns b_healthout_z b_weight_18m b_weight_36m b_muac_18m b_muac_36m 
	
	local m_healthoutcomes m_healthout_z m_weight_18m_z m_weight_36m_z m_muac_18m_z m_muac_36m_z 
	local m_healthoutcomes_ns m_healthout_z m_weight_18m m_weight_36m m_muac_18m m_muac_36m 
	
	local e_healthoutcomes e_healthout_z e_weight_18m_z e_weight_36m_z e_muac_18m_z e_muac_36m_z 
	local e_healthoutcomes_ns e_healthout_z e_weight_18m e_weight_36m e_muac_18m e_muac_36m 

	*******************
	* Child Mortality *
	*******************
	
	* As we will regress the child mortality over its non-standardized index components, we need to create a local
	
	*_ns stands for non-standardized and consists of non-standardized index components
	
	* We create local for child mortality index without prefix
	
	local childmortality mortrate_05 mortrate_01 mortrate_15 
	
	* We create local for child mortality index with prefix
	
	local b_childmortality b_mortrate_05 b_mortrate_01 b_mortrate_15 
	
	local m_childmortality m_mortrate_05 m_mortrate_01 m_mortrate_15
	
	local e_childmortality e_mortrate_05 e_mortrate_01 e_mortrate_15
	
	********************
	* Citizen pressure *
	*******************
	
	* As we will regress the citizen pressure over its non-standardized index components, we need to create a local
	
	*_ns stands for non-standardized and consists of non-standardized index components
	
	* We create local for citizen pressure index without prefix
	
	local ctzpressure_z h_ctzpressure_z h_wrong_z h_pressure_z
	local ctzpressure_ns h_ctzpressure_z h_wrong h_pressure
	
	local m_ctzpressure_z h_ctzpressure_z h_wrong_z h_pressure_z
	
	local ctzpressure_nobase h_hw_report_z	
	local ctzpressure_nobase_ns h_hw_report	
	
	* We create local for child mortality index with prefix
	
	local b_h_ctzpressure b_h_ctzpressure_z b_h_wrong_z b_h_pressure_z b_h_hw_report_z	
	local b_h_ctzpressure_ns b_h_ctzpressure_z b_h_wrong b_h_pressure b_h_hw_report
	
	local bm_h_ctzpressure bm_h_ctzpressure_z bm_h_wrong_z bm_h_pressure_z	
	
	local m_h_ctzpressure m_h_ctzpressure_z m_h_wrong_z m_h_pressure_z
	
	local e_h_ctzpressure e_h_ctzpressure_z e_h_wrong_z e_h_pressure_z e_h_hw_report_z	
	local e_h_ctzpressure_ns e_h_ctzpressure_z e_h_wrong e_h_pressure e_h_hw_report	
	
	**********************************************************
	** Controlvar corresponds to the main control variables **
	**********************************************************
	
	* All the variable are measured at baseline
		* health center is a health center II: hc2
		* health center is providing a official delivery services: b_h_del
		* health center has a staff house: b_h_staff_houses 
		* the household declared to have visited the health center: b_visited_d
		* years of education of the interviewed head of HH: educyr
		* households asset index: b_assetindex
	
	local  m_controls_noprefix hc2 b_h_del b_h_staff_houses bm_visited_d bm_educyr bm_assetindex
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	* We create the different type of local for the different sample at midline
	
	foreach x in m_ {
	
		local `x'controls
		local `x'controls_vacm
		local `x'controls_hom
		local `x'controls_ho18m
		local `x'controls_ho36m
		local `x'controls_hc
		local `x'controls_tfull
		local `x'controls_tfull_hom
		local `x'controls_tfull_ho18m
		local `x'controls_tfull_ho36m
		local `x'controls_tfull_hc
		local `x'controls_tfull_homhc
		
		local tfulli_homhc_`x'controls
		
		}
	
	* We create the different type of local for the different sample at endline
	
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_vace
		local `x'controls_hoe
		local `x'controls_ho18e
		local `x'controls_ho36e
		local `x'controls_hc
		local `x'controls_tfull
		local `x'controls_tfull_hoe
		local `x'controls_tfull_ho18e
		local `x'controls_tfull_ho36e
		local `x'controls_tfull_hc
		local `x'controls_tfull_hoehc
		
		local tfulli_hoehc_`x'controls
		
		}
		
	* We create the different types of local for the interaction term at midline and endline and for each part of the factorial design
	
		foreach x in m_ e_ {
			foreach var in treatfull treatinfo treatinter {
				local `var'_int_`x'controls
				local `var'_hc_int_`x'controls
				}
			}
			
	* We do the same for the restricted sample (vaccinated, healthoutcome, healthoutcome under 18, under 36 at midline and endline)
		
		foreach x in m_ e_ {
			foreach var in tfulli tinfoi tinteri {
				local `var'_vacm_`x'controls
				local `var'_hom_`x'controls
				local `var'_ho18m_`x'controls
				local `var'_ho36m_`x'controls
				local `var'_hoe_`x'controls
				local `var'_ho18e_`x'controls
				local `var'_ho36e_`x'controls
				}
			}
		
	* We populate the different local we previously created
	
		foreach var of local m_controls_noprefix {
			local m_controls `m_controls' c_`var'
			local m_controls_hc `m_controls_hc' c_hc_`var'
			local m_controls_tfull `m_controls_tfull' c_tfull_`var'
			local m_controls_tfull_hc `m_controls_tfull_hc' c_tfull_hc_`var'
			}
			
		foreach var of local e_controls_noprefix {
			local e_controls `e_controls' c_`var'
			local e_controls_hc `e_controls_hc' c_hc_`var'
			local e_controls_tfull `e_controls_tfull' c_tfull_`var'
			local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
			}
			
			
		foreach var of local m_controls_noprefix {
			local m_controls_vacm `m_controls_vacm' c_vacm_`var'
			local m_controls_hom `m_controls_hom' c_hom_`var'
			local m_controls_ho18m `m_controls_ho18m' c_ho18m_`var'
			local m_controls_ho36m `m_controls_ho36m' c_ho36m_`var'
			local m_controls_tfull_vacm `m_controls_tfull_vacm' c_tfull_vacm_`var'
			local m_controls_tfull_hom `m_controls_tfull_hom' c_tfull_hom_`var'
			local m_controls_tfull_ho18m `m_controls_tfull_ho18m' c_tfull_ho18m_`var'
			local m_controls_tfull_ho36m `m_controls_tfull_ho36m' c_tfull_ho36m_`var'
			local m_controls_tfull_homhc `m_controls_tfull_homhc' c_tfull_homhc_`var'
			}	
		
		foreach var of local e_controls_noprefix {
			local e_controls_vace `e_controls_vacm' c_vace_`var'
			local e_controls_hoe `e_controls_hoe' c_hoe_`var'
			local e_controls_ho18e `e_controls_ho18e' c_ho18e_`var'
			local e_controls_ho36e `e_controls_ho36e' c_ho36e_`var'
			local e_controls_tfull_vace `e_controls_tfull_vace' c_tfull_vace_`var'
			local e_controls_tfull_hoe `e_controls_tfull_hoe' c_tfull_hoe_`var'
			local e_controls_tfull_ho18e `e_controls_tfull_ho18e' c_tfull_ho18e_`var'
			local e_controls_tfull_ho36e `e_controls_tfull_ho36e' c_tfull_ho36e_`var'
			local e_controls_tfull_hoehc `e_controls_tfull_hoehc' c_tfull_hoehc_`var'
			}	
				
		foreach treat in treatfull treatinfo treatinter {
			foreach var of local m_controls_noprefix {
				local `treat'_int_m_controls ``treat'_int_m_controls' c_`treat'_`var'
				local `treat'_hc_int_m_controls ``treat'_hc_int_m_controls' c_`treat'_hc_`var'
				}
			}
			
		foreach treat in treatfull treatinfo treatinter {
			foreach var of local e_controls_noprefix {
				local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
				local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
				}
			}
			
		foreach treat in tfulli tinfoi tinteri {
			foreach var of local m_controls_noprefix {
				local `treat'_vacm_m_controls ``treat'_vacm_m_controls' c_`treat'_vacm_`var'
				local `treat'_hom_m_controls ``treat'_hom_m_controls' c_`treat'_hom_`var'
				local `treat'_ho18m_m_controls ``treat'_ho18m_m_controls' c_`treat'_ho18m_`var'
				local `treat'_ho36m_m_controls ``treat'_ho36m_m_controls' c_`treat'_ho36m_`var'
				}		
			}
			
		foreach treat in tfulli tinfoi tinteri {
			foreach var of local e_controls_noprefix {
				local `treat'_vace_e_controls ``treat'_vace_e_controls' c_`treat'_vace_`var'
				local `treat'_hoe_e_controls ``treat'_hoe_e_controls' c_`treat'_hoe_`var'
				local `treat'_ho18e_e_controls ``treat'_ho18e_e_controls' c_`treat'_ho18e_`var'
				local `treat'_ho36e_e_controls ``treat'_ho36e_e_controls' c_`treat'_ho36e_`var'
				}
			}
			
		foreach var of local m_controls_noprefix {
				local tfulli_homhc_m_controls `tfulli_homhc_m_controls' c_tfulli_homhc_`var'
				}
				
		foreach var of local e_controls_noprefix {
				local tfulli_hoehc_e_controls `tfulli_hoehc_e_controls' c_tfulli_hoehc_`var'
				}
				
	* Omnibus case
			
	* The Factorial design also implies the omnibus cas for which we create the local for the interaction
		
		
		foreach treat in fullomn infomn intomn {
			foreach var of local m_controls_noprefix {
				local `treat'_int_m_controls ``treat'_int_m_controls' c_`treat'_`var'
				local `treat'_vacm_int_m_controls ``treat'_vacm_int_m_controls' c_`treat'_vacm_`var'
				local `treat'_hom_int_m_controls ``treat'_hom_int_m_controls' c_`treat'_hom_`var'
				local `treat'_ho18m_int_m_controls ``treat'_ho18m_int_m_controls' c_`treat'_ho18m_`var'
				local `treat'_ho36m_int_m_controls ``treat'_ho36m_int_m_controls' c_`treat'_ho36m_`var'
				local `treat'_hc_int_m_controls ``treat'_hc_int_m_controls' c_`treat'_hc_`var'
				}
			}
			
		foreach treat in fullomn infomn intomn {
			foreach var of local e_controls_noprefix {
				local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
				local `treat'_vace_int_e_controls ``treat'_vace_int_e_controls' c_`treat'_vace_`var'
				local `treat'_hoe_int_e_controls ``treat'_hoe_int_e_controls' c_`treat'_hoe_`var'
				local `treat'_ho18e_int_e_controls ``treat'_ho18e_int_e_controls' c_`treat'_ho18e_`var'
				local `treat'_ho36e_int_e_controls ``treat'_ho36e_int_e_controls' c_`treat'_ho36e_`var'
				local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
				}
			}
	
	* Additional variable for individual level health outcome
	
	local controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
	
	* We create the set of locals
	
	local controls
	local controls_tfull
	local controls_tfullho
	local controls_tfullim
	
	forvalues x = 1/2 {
		local controls_tfullho`x'
		local controls_ho`x'
		}
		
	forvalues x = 1/4 {
		local controls_tfullim`x'
		local controls_im`x'
		}

	foreach var in treatfull treatinter treatinfo {
		local `var'_int_controls
		}
		
	forvalues x = 1/2 {
		foreach var in treatfull treatinter treatinfo {
			local `var'_ho`x'_controls
			}
		}
	
	forvalues x = 1/4 {
		foreach var in treatfull treatinter treatinfo {
			local `var'_im`x'_controls
			}
		}
		
	* We populate the control variables we just created
	
	foreach var of local controls_noprefix {
		local controls `controls' c_`var'
		}
	
	
	foreach var of local controls_noprefix {
		local controls_tfull `controls_tfull' c_tfull_`var'
		}
		
	forvalues x = 1/2 {
		foreach var of local controls_noprefix {
			local controls_ho`x' `controls_ho`x'' c_ho`x'_`var'
			}
		}
		
	forvalues x = 1/2 {
		foreach var of local controls_noprefix {
			local controls_tfullho`x' `controls_tfullho`x'' c_tfullho`x'_`var'
			}
		}
		
	forvalues x = 1/4 {
		foreach var of local controls_noprefix {
			local controls_im`x' `controls_im`x'' c_im`x'_`var'
			}
		}
		
	forvalues x = 1/4 {
		foreach var of local controls_noprefix {
			local controls_tfullim`x' `controls_tfullim`x'' c_tfullim`x'_`var'
			}
		}

	foreach treat in treatfull treatinfo treatinter infint {
		local `treat'_controls
		foreach var of local controls_noprefix {
			local `treat'_controls ``treat'_controls' c_`treat'_`var'
			}
		}
		
	foreach treat in fullomn infomn intomn {
		local `treat'_int_controls
		foreach var of local controls_noprefix {
			local `treat'_int_controls ``treat'_int_controls' c_`treat'_`var'
			}
		}
		
	forvalues x = 1/2 {
		foreach treat in treatfull treatinfo treatinter infint {
			local `treat'_ho`x'_controls
			foreach var of local controls_noprefix {
				local `treat'_ho`x'_controls ``treat'_ho`x'_controls' c_`treat'ho`x'_`var'
				}
			}
		}
		
	forvalues x = 1/2 {
		foreach treat in fullomn infomn intomn {
			local `treat'_ho`x'_controls
			foreach var of local controls_noprefix {
				local `treat'_ho`x'_controls ``treat'_ho`x'_controls' c_`treat'ho`x'_`var'
				}
			}
		}
		
	forvalues x = 1/4 {
		foreach treat in treatfull treatinfo treatinter infint {
			local `treat'_im`x'_controls
			foreach var of local controls_noprefix {
				local `treat'_im`x'_controls ``treat'_im`x'_controls' c_`treat'im`x'_`var'
				}
			}
		}
		
	forvalues x = 1/4 {
		foreach treat in fullomn infomn intomn {
			local `treat'_im`x'_controls 
			foreach var of local controls_noprefix {
				local `treat'_im`x'_controls ``treat'_im`x'_controls' c_`treat'im`x'_`var'
				}
			}
		}

	*********************************************
	** Additional variables for balance checks **
	*********************************************
	
	* The additional variables for balance checks:
		* Number of visits of VHTs to households in the last 12 months: b_tot_visit_vht
		* Whether the HC has piped water: b_h_piped_water
		* Whether the HC has electricity (grid or solar): b_h_elecsource
		* The number of trained medical staff at the HC: b_h_trainedstaff
		* The population density of the 3 km radius around the health center (using LandScan GIS data): b_h_popdensity
	
	* We will need to add:
		* Distance to the nearest health provider (government or private/NGO) at the same or higher level ADD
		* The population density of the 3 km radius around the health center (using LandScan GIS data) ADD

	local addlbalvars b_totvisit_vht b_h_piped_water b_h_elecsource b_h_trainedstaff b_h_popdensity
	
	**********************	
	** Intermediate DVs **
	**********************
	
	local intermediate ctzknow_z eff_z commresp_z relhhhc_z
	local intermediate_hclevel h_hcpknow_z h_hctrans_z
	
	local b_intermediate b_ctzknow_z b_h_hcpknow_z b_eff_z b_commresp_z  b_relhhhc_z b_h_hctrans_z
	local bm_intermediate bm_ctzknow_z bm_h_hcpknow_z bm_eff_z bm_commresp_z  bm_relhhhc_z bm_h_hctrans_z
	
	local m_intermediate m_ctzknow_z m_h_hcpknow_z m_eff_z m_commresp_z  m_relhhhc_z m_h_hctrans_z
	
	local e_intermediate e_ctzknow_z e_h_hcpknow_z e_eff_z e_commresp_z  e_relhhhc_z e_h_hctrans_z
		
	*********************
	* Citizen knowledge *
	*********************
	
	* We create a local for citizen knowledge without prefix
	
	local citizenknowledge ctzknow_z numrights_hh_z numresp_hh_z 
	local citizenknowledge_nobaseline services_hh_z
	
	local citizenknowledge_ns ctzknow_z numrights_hh numresp_hh
	local citizenknowledge_nobaseline_ns services_hh
	
	* We create a local for citizen knowledge with prefix
	
	local b_citizenknowledge b_ctzknow_z b_numrights_hh_z b_numresp_hh_z
	local b_citizenknowledge_ns b_ctzknow_z b_numrights_hh b_numresp_hh
	
	local m_citizenknowledge m_ctzknow_z m_numrights_hh_z m_numresp_hh_z m_services_hh_z
	local m_citizenknowledge_ns m_ctzknow_z m_numrights_hh m_numresp_hh m_services_hh	
	
	local e_citizenknowledge e_ctzknow_z e_numrights_hh_z e_numresp_hh_z e_services_hh_z
	local e_citizenknowledge_ns e_ctzknow_z e_numrights_hh e_numresp_hh e_services_hh
		
	**********************************
	* Health care provider knowledge *
	**********************************
	
	* We create a local for health care provider knowledge without prefix
	
	local h_hcknowledge h_hcpknow_z h_numrights_z h_numresp_z
	local h_hcknowledge_ns h_hcpknow_z h_numrights h_numresp
	
	* We create a local for health care provider knowledge with prefix
		
	local b_h_hcknowledge b_h_hcpknow_z b_h_numrights_z b_h_numresp_z
	local b_h_hcknowledge_ns b_h_hcpknow_z b_h_numrights b_h_numresp
	
	local m_h_hcknowledge m_h_hcpknow_z m_h_numrights_z m_h_numresp_z
	local m_h_hcknowledge_ns m_h_hcpknow_z m_h_numrights m_h_numresp
	
	local e_h_hcknowledge e_h_hcpknow_z e_h_numrights_z e_h_numresp_z
	local e_h_hcknowledge_ns e_h_hcpknow_z e_h_numrights e_h_numresp
	
	************
	* Efficacy *
	************
	
	* We create a local for efficacy without prefix
		
	local efficacy eff_z power_z influence_z peoplesay_gov_z peoplesay_hc_z
	local efficacy_nobaseline pressure_effort_z pressure_report_z
	local efficacy_ns eff_z power influence peoplesay_gov peoplesay_hc
	local efficacy_nobaseline_ns pressure_effort pressure_report
	
	* We create a local for efficacy with prefix
	
	local b_efficacy b_eff_z b_power_z b_influence_z b_peoplesay_gov_z b_peoplesay_hc_z
	local b_efficacy_ns b_eff_z b_power b_influence b_peoplesay_gov b_peoplesay_hc
	
	local m_efficacy m_eff_z m_power_z m_pressure_effort_z m_pressure_report_z m_influence_z m_peoplesay_gov_z m_peoplesay_hc_z
	local m_efficacy_ns m_eff_z m_power m_pressure_effort m_pressure_report m_influence m_peoplesay_gov m_peoplesay_hc	
	
	local e_efficacy e_eff_z e_power_z e_pressure_effort_z e_pressure_report_z e_influence_z e_peoplesay_gov_z e_peoplesay_hc_z
	local e_efficacy_ns e_eff_z e_power e_pressure_effort e_pressure_report e_influence e_peoplesay_gov e_peoplesay_hc
	
	****************************
	* Community Responsibility *
	****************************
	
	* We create a local for community responsibility without prefix
	
	local commresp commresp_z responsible_z commembers_resp_z
	local commresp_ns commresp_z responsible commembers_resp
	
	* We create a local for community responsibility with prefix
	
	local b_commresp b_commresp_z b_responsible_z b_commembers_resp_z
	local b_commresp_ns b_commresp_z b_responsible b_commembers_resp
	
	local m_commresp m_commresp_z m_responsible_z m_commembers_resp_z
	local m_commresp_ns m_commresp_z m_responsible m_commembers_resp
	
	local e_commresp e_commresp_z e_responsible_z e_commembers_resp_z
	local e_commresp_ns e_commresp_z e_responsible e_commembers_resp
	
	*************************
	* Community Monitoring  *
	*************************
	
	* We create a local for community monitoring without prefix
	
	* We removed the HUMC indicator
	
	local commmonitoring commtg_z lc1_meetings_z lc1_meetings_hc_z 
	local commmonitoring_nobaseline find_report_z find_effort_z 
	
	local commmonitoring_ns commtg_z lc1_meetings lc1_meetings_hc
	local commmonitoring_nobaseline_ns find_report find_effort

	* We create a local for community monitoring with prefix
	
	local b_commmonitoring b_commtg_z b_lc1_meetings_z b_lc1_meetings_hc_z 
	local b_commmonitoring_ns b_commtg_z b_lc1_meetings b_lc1_meetings_hc 
	
	local m_commmonitoring m_commtg_z m_lc1_meetings_z m_lc1_meetings_hc_z m_find_report_z m_find_effort_z 
	local m_commmonitoring_ns m_commtg_z m_lc1_meetings m_lc1_meetings_hc m_find_report m_find_effort
	
	local e_commmonitoring e_commtg_z e_lc1_meetings_z e_lc1_meetings_hc_z e_find_report_z e_find_effort_z
	local e_commmonitoring_ns e_commtg_z e_lc1_meetings e_lc1_meetings_hc e_find_report e_find_effort

	******************************
	* Health centre transparency *
	******************************
	
	* We create a local for health centre transparency without prefix
	
	local h_hctransp h_hctrans_z h_opening_posters_z h_dutyroster_z h_sugbox_z h_infoservice_z h_infoprights_z
	local h_hctransp_ns h_hctrans_z h_opening_posters h_dutyroster h_sugbox h_infoservice h_infoprights
	
	* We create a local for health centre transparency with prefix
	
	local b_h_hctransp b_h_hctrans_z b_h_opening_posters_z b_h_dutyroster_z b_h_sugbox_z b_h_infoservice_z b_h_infoprights_z
	local b_h_hctransp_ns b_h_hctrans_z b_h_opening_posters b_h_dutyroster b_h_sugbox b_h_infoservice b_h_infoprights
	
	local m_h_hctransp m_h_hctrans_z m_h_opening_posters_z m_h_dutyroster_z m_h_sugbox_z m_h_infoservice_z m_h_infoprights_z
	local m_h_hctransp_ns m_h_hctrans_z m_h_opening_posters m_h_dutyroster m_h_sugbox m_h_infoservice m_h_infoprights
	
	local e_h_hctransp e_h_hctrans_z e_h_opening_posters_z e_h_dutyroster_z e_h_sugbox_z e_h_infoservice_z e_h_infoprights_z
	local e_h_hctransp_ns e_h_hctrans_z e_h_opening_posters e_h_dutyroster e_h_sugbox e_h_infoservice e_h_infoprights

	****************************************************
	* Relationship between health center and community *
	****************************************************
	
	* We create a local for relationship between health center and community without prefix
	
	local relship relhhhc_z sat_rel_z trust_hw_z complain_z
	local relship_hclevel h_satisfiedrel_z
	
	local relship_ns relhhhc_z sat_rel trust_hw complain
	local relship_hclevel_ns h_satisfiedrel
	
	* We create a local for relationship between health center and community with prefix
		
	local b_relship b_relhhhc_z b_sat_rel_z b_trust_hw_z b_h_satisfiedrel_z b_complain_z
	local b_relship_ns b_relhhhc_z b_sat_rel b_trust_hw b_h_satisfiedrel b_complain
	
	local m_relship m_relhhhc_z m_sat_rel_z m_trust_hw_z m_h_satisfiedrel_z m_complain_z
	local m_relship_ns m_relhhhc_z m_sat_rel m_trust_hw m_h_satisfiedrel m_complain
	
	local e_relship e_relhhhc_z e_sat_rel_z e_trust_hw_z e_h_satisfiedrel_z e_complain_z
	local e_relship_ns e_relhhhc_z e_sat_rel e_trust_hw e_h_satisfiedrel e_complain
	
	************************************************************************************************ END OF SETUP **********************************************************
	
	***********
	* Dataset *
	***********
	
	* We load the dataset. This is the light version
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* Install additional functions
	
	ssc install qreg2
	ssc install matsort
	ssc install texdoc
	ssc install coefplot 
	ssc install mdesc 
	
	
	******************************************************************
	* Table 1: Outcome indices and their components, baseline values *
	******************************************************************

	* Utilization
	
	foreach var in b_immunization b_hf_otherpract {
		sum `var'
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.1fc")
		local `var'_sd = string(`r(sd)',"%9.1fc")
		}
		
	sum b_visit_hf
	local b_visit_hf_m = string(`r(mean)',"%9.1fc")
	local b_visit_hf_sd = string(`r(sd)',"%9.1fc")
	
	* Treatment quality
	
	foreach var in b_use_equip b_trained b_exam_privacy b_taketest b_diagnosis_explained {
		sum `var'
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.1fc")
		local `var'_sd = string(`r(sd)',"%9.1fc")
		}
	
	sum b_tot_wait
	local b_tot_wait_m = string(`r(mean)',"%9.0fc")
	local b_tot_wait_sd = string(`r(sd)',"%9.0fc")
	
	foreach var in b_h_percentstaff_sv b_h_cleanliness b_h_meanstock {
		sum `var' if uniquehc == 1
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.1fc")
		local `var'_sd = string(`r(sd)',"%9.1fc")
		}

	* Patient satisfaction
	
	foreach var in b_qualitycare b_politestaff b_interest_health b_stafflistening b_freeexpress b_yearb_avail {
		sum `var'
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.1fc")
		local `var'_sd = string(`r(sd)',"%9.1fc")
		}
		
	foreach var in m_qualityhc_d {
		sum `var' if treatment == 4
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.1fc")
		local `var'_sd = string(`r(sd)',"%9.1fc")
		}
		
	* Community monitoring
	
	foreach var in b_lc1_meetings b_lc1_meetings_hc {
		sum `var'
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.1fc")
		local `var'_sd = string(`r(sd)',"%9.1fc")
		}
	
		
	foreach var in m_find_report m_find_effort {
		sum `var' if treatment == 4
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.1fc")
		local `var'_sd = string(`r(sd)',"%9.1fc")
		}
		
	* Health outcome
	
	* We load the individual dataset
	
	use "${usedata}/healthoutcome_endline_ind.dta", clear
	
	foreach var in b_weight18 b_weight36 b_muac18 b_muac36 {
		sum `var'
		local `var'_m = string(`r(mean)',"%9.2fc")
		local `var'_sd = string(`r(sd)',"%9.2fc")
		}
		
	* Child mortality
	
	* We load the light dataset (HC level)
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	foreach var in b_mortrate_05 b_mortrate_01 b_mortrate_15 b_h_wrong b_h_pressure  {
		sum `var' if uniquehc == 1
		local `var'_m = string(`r(mean)',"%9.2fc")
		local `var'_sd = string(`r(sd)',"%9.2fc")
		}
		
	foreach var in e_h_hw_report {
		sum `var' if treatment == 4
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.2fc")
		local `var'_sd = string(`r(sd)',"%9.2fc")
		}
		
	* Generating the table
	
	texdoc init "${tables}/Table1.tex", replace force
	tex \begin{table}[]
	tex \footnotesize
	tex \begin{center}
	tex	\begin{tabular}{ll}
	tex	\hline
    tex                                                                                                                                                                                                         & \textbf{Mean} \\ \hline
	tex \multicolumn{2}{l}{\textit{\textbf{Citizen monitoring}}}                                                                                                                                                                                                                                \\ \hline
	tex Household members report having attended LC1 meetings in the last year                                                                                                                                                                                         &   `b_lc1_meetings_m'\%   \\ 
	tex \begin{tabular}[c]{@{}l@{}}Household members who attended the LC1 meeting reported that the local HC was discussed\end{tabular}                                                                                                                              &   `b_lc1_meetings_hc_m'\%   \\ 
	tex \begin{tabular}[c]{@{}l@{}}Household members think community would find out if health worker did not provide effort caring for patients $\diamond$ \end{tabular}                                    &   `m_find_effort_m'\% \\ 
	tex \begin{tabular}[c]{@{}l@{}}Household members think community would find out if health worker did not report for work $\diamond$ \end{tabular}                                                                                                    &   `m_find_report_m'\%   \\ \hline
	tex \multicolumn{2}{l}{\textit{\textbf{Perceived citizen pressure}}}                                                                                                                                                                            \\ \hline
	tex \begin{tabular}[c]{@{}l@{}}HC staff think community would find out if health worker did not provide effort in caring for patients \end{tabular}                                    &   `b_h_wrong_m'\% \\ 
	tex \begin{tabular}[c]{@{}l@{}}HC staff think community members would find out if health worker did not report for work \end{tabular}                                                                                                    &   `b_h_pressure_m'\%   \\ 
	tex \begin{tabular}[c]{@{}l@{}}Any community member reported a health worker to HC staff within the past 12 months $\diamond$ \end{tabular}    &   `e_h_hw_report_m'\%   \\ \hline
	tex	\multicolumn{2}{l}{\textit{\textbf{Utilization}}}                                                                                                                                                                                \\ \hline
	tex \begin{tabular}[c]{@{}l@{}}Vaccination rates, children <36 months for polio, DPT, BCG, and measles, by age bracket\end{tabular}                                                                     &  `b_immunization_m'\%         \\         
	tex \begin{tabular}[c]{@{}l@{}}Share of self-reported visits to the HC versus other providers\end{tabular}                                                                                          &  `b_hf_otherpract_m'\%        \\ 
	tex \begin{tabular}[c]{@{}l@{}}Number of self-reported visits to the HC by household members in past 12 months\end{tabular}                                                                      &  `b_visit_hf_m' visits        \\ \hline
	tex \multicolumn{2}{l}{\textit{\textbf{Treatment quality}}}                                                                                                                                                                          \\ \hline
	tex Whether equipment was used during the most recent visit to HC                                                                                                                                                     &  `b_use_equip_m'\%        \\ 
	tex Total time spent waiting for initial consultation and examination                                                                                                                                      &  `b_tot_wait_m' mins      \\ 
	tex \begin{tabular}[c]{@{}l@{}}Whether person seeking care was examined by trained health staff during most recent visit\end{tabular}                                                         &  `b_trained_m'\%          \\ 
	tex Whether person seeking care had privacy during most recent examination                                                                                                                         &  `b_exam_privacy_m'\%     \\ 
	tex Whether lab tests were administered during most recent visit                                                                                                                                            &  `b_taketest_m'\%         \\ 
	tex \begin{tabular}[c]{@{}l@{}}Whether diagnosis was clearly explained during most recent visit\end{tabular}                                                            &  `b_diagnosis_explained_m'\%    \\ 
	tex Percent of staff in attendance during unannounced visit to HC                                                                                                                             &  `b_h_percentstaff_sv_m'\%      \\ 
	tex \begin{tabular}[c]{@{}l@{}}Condition of HC (cleanliness of floors/walls; smell) as observed during unannounced visit\end{tabular}                                                   &  `b_h_cleanliness_m'\%          \\ 
	tex \begin{tabular}[c]{@{}l@{}}\% of months stock cards indicate availability of 6 key drugs in past 3 mos, as determined during unannounced visit\end{tabular}             &  `b_h_meanstock_m'\%               \\ \hline
	tex \multicolumn{2}{l}{\textit{\textbf{Patient satisfaction}}}                                                                                                                                                                       \\ \hline
	tex \begin{tabular}[c]{@{}l@{}}Whether services currently offered at HC are judged to be of ``very high" or ``somewhat high" quality  $\diamond$\end{tabular}                                                 &  `m_qualityhc_d_m'\%               \\ 
	tex \begin{tabular}[c]{@{}l@{}}Whether person seeking care was ``very satisfied"/``satisfied" with quality of care received during most recent visit\end{tabular} &  `b_qualitycare_m'\%                          \\ 
	tex \begin{tabular}[c]{@{}l@{}}Whether person conducting exam appeared to be interested in health condition of person seeking care\end{tabular}                                         &  `b_interest_health_m'\%                        \\ 
	tex Whether person conducting exam listened to what person seeking care had to say                                                                                                            &  `b_stafflistening_m'\%                         \\ 
	tex \begin{tabular}[c]{@{}l@{}}Whether person seeking care felt free to express him/herself to person conducting exam\end{tabular}                                                          &  `b_freeexpress_m'\%                            \\ 
	tex Whether, compared to year before, availability of medical staff has improved at HC                                                                                                     &  `b_yearb_avail_m'\%                            \\ \hline
	tex \multicolumn{2}{l}{\textit{\textbf{Health outcomes}}}                                                                                                                                                                            \\ \hline
	tex Weight for age among children aged 0-18 months (kg/month)                                                                                                                                                             &  `b_weight18_m'           \\ 
	tex Weight for age among children aged 18-36 months (kg/month)                                                                                                                                                            &  `b_weight36_m'           \\ 
	tex Middle-upper arm circumference among children aged 0-18 months (cm/month)                                                                                                                                                     &  `b_muac18_m'             \\ \hline
	tex \multicolumn{2}{l}{\textit{\textbf{Child mortality}}}                                                                                                                                                                            \\ \hline
	tex 0 to 5 years (main measure)                                                                                                                                                                                   &   `b_mortrate_05_m'\text{\textperthousand}           \\ 
	tex 0 to 12 months                                                                                                                                                                                                &   `b_mortrate_01_m'\text{\textperthousand}           \\ 
	tex 1 to 5 years                                                                                                                                                                                                  &   `b_mortrate_15_m'\text{\textperthousand}           \\ \hline                                                                                                
	tex \end{tabular}
	tex \end{center}
	tex \end{table}
	texdoc close
	
	
	
	*****************************************************
	* Figure 3: Effect of the full treatment at endline *
	*****************************************************
	
	* Setting up the local
	
	local indices urate_z treatqual_z patsat_z commtg_z
	local indices_hc_ols h_ctzpressure_z
	local indices_hc mortrate_05 
	
	*******************
	* Household level *
	*******************
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	local var treatfull
	
	* At endline:
	
	local y = 1
	foreach x in `indices' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		estimates store me`y'
		
		local n_1e_`x' = string(`e(N)',"%9.0fc")
		local r2_1e_`x' = string(`e(r2)',"%9.3fc")
		local est_1e_`x' = string(_b[`var'],"%9.3fc")
		local se_1e_`x' = string(_se[`var'],"%9.3fc")
		local p_1e_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		local p_`y'e = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1e_1s_`x' = (`p_1e_`x''<=0.1 & `p_1e_`x''>0.05)
		gen s_1e_2s_`x' = (`p_1e_`x''<=0.05 & `p_1e_`x''>0.01)
		gen s_1e_3s_`x' = (`p_1e_`x''<=0.01 & `p_1e_`x''>=0)
	
		if s_1e_1s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''*"
				}
				
		if s_1e_2s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''**"
				}
				
		if s_1e_3s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''***"
				}
		
		local est_2e_`x' = string(_b[_cons],"%9.3fc")
		local se_2e_`x' = string(_se[_cons],"%9.3fc")
		local p_2e_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_2e_1s_`x' = (`p_2e_`x''<=0.1 & `p_2e_`x''>0.05)
		gen s_2e_2s_`x' = (`p_2e_`x''<=0.05 & `p_2e_`x''>0.01)
		gen s_2e_3s_`x' = (`p_2e_`x''<=0.01 & `p_2e_`x''>=0)
	
		if s_2e_1s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''*"
				}
				
		if s_2e_2s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''**"
				}
				
		if s_2e_3s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''***"
				}
				
		test treatfull = 0
		local f_walde_`x' = string(`r(p)',"%9.3fc")
		
					
		local y = `y' + 1
		}
		
	foreach x in `indices_hc_ols' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		estimates store me`y'
		
		local n_1e_`x' = string(`e(N)',"%9.0fc")
		local r2_1e_`x' = string(`e(r2)',"%9.3fc")
		local est_1e_`x' = string(_b[`var'],"%9.3fc")
		local se_1e_`x' = string(_se[`var'],"%9.3fc")
		local p_1e_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		local p_`y'e = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1e_1s_`x' = (`p_1e_`x''<=0.1 & `p_1e_`x''>0.05)
		gen s_1e_2s_`x' = (`p_1e_`x''<=0.05 & `p_1e_`x''>0.01)
		gen s_1e_3s_`x' = (`p_1e_`x''<=0.01 & `p_1e_`x''>=0)
	
		if s_1e_1s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''*"
				}
				
		if s_1e_2s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''**"
				}
				
		if s_1e_3s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''***"
				}
		
		local est_2e_`x' = string(_b[_cons],"%9.3fc")
		local se_2e_`x' = string(_se[_cons],"%9.3fc")
		local p_2e_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_2e_1s_`x' = (`p_2e_`x''<=0.1 & `p_2e_`x''>0.05)
		gen s_2e_2s_`x' = (`p_2e_`x''<=0.05 & `p_2e_`x''>0.01)
		gen s_2e_3s_`x' = (`p_2e_`x''<=0.01 & `p_2e_`x''>=0)
	
		if s_2e_1s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''*"
				}
				
		if s_2e_2s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''**"
				}
				
		if s_2e_3s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''***"
				}
				
		test treatfull = 0
		local f_walde_`x' = string(`r(p)',"%9.3fc")
		
					
		local y = `y' + 1
		}
	
	********************
	* Individual level *
	********************
	
	* Health outcome
	
	* At endline
	
	use "${usedata}/healthoutcome_endline_ind.dta", clear
	
	***************
	* Regressions *
	***************

	local var treatfull
	
	areg  e_healthoutcome_z treatfull b_healthoutcome_z b_healthoutcome_z_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district) 
	
		estimates store me6
		
		local n_1e_healthout_z = string(`e(N)',"%9.0fc")
		local r2_1e_healthout_z = string(`e(r2)',"%9.3fc")
		local est_1e_healthout_z = string(_b[`var'],"%9.3fc")
		local se_1e_healthout_z = string(_se[`var'],"%9.3fc")
		local p_1e_healthout_z = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		local p_6e = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1e_1s_healthout_z = (`p_1e_healthout_z'<=0.1 & `p_1e_healthout_z'>0.05)
		gen s_1e_2s_healthout_z = (`p_1e_healthout_z'<=0.05 & `p_1e_healthout_z'>0.01)
		gen s_1e_3s_healthout_z = (`p_1e_healthout_z'<=0.01 & `p_1e_healthout_z'>=0)
	
		if s_1e_1s_healthout_z == 1 {
				local est_1e_healthout_z = "`est_1e_healthout_z'*"
				}
				
		if s_1e_2s_healthout_z == 1 {
				local est_1e_healthout_z = "`est_1e_healthout_z'**"
				}
				
		if s_1e_3s_healthout_z == 1 {
				local est_1e_healthout_z = "`est_1e_healthout_z'***"
				}
		
		local est_2e_healthout_z = string(_b[_cons],"%9.3fc")
		local se_2e_healthout_z = string(_se[_cons],"%9.3fc")
		local p_2e_healthout_z = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_2e_1s_healthout_z = (`p_2e_healthout_z'<=0.1 & `p_2e_healthout_z'>0.05)
		gen s_2e_2s_healthout_z = (`p_2e_healthout_z'<=0.05 & `p_2e_healthout_z'>0.01)
		gen s_2e_3s_healthout_z = (`p_2e_healthout_z'<=0.01 & `p_2e_healthout_z'>=0)
	
		if s_2e_1s_healthout_z == 1 {
				local est_2e_healthout_z = "`est_2e_healthout_z'*"
				}
				
		if s_2e_2s_healthout_z == 1 {
				local est_2e_healthout_z = "`est_2e_healthout_z'**"
				}
				
		if s_2e_3s_healthout_z == 1 {
				local est_2e_healthout_z = "`est_2e_healthout_z'***"
				}
				
		test treatfull = 0
		local f_walde_healthout_z = string(`r(p)',"%9.3fc")
		
	
	* Child mortality
	
	* At endline
	
	use "${usedata}/chp_el_light_dataset.dta", clear
		
	* We create the Mortality control variables local
	
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
	
	foreach bracket in 01 05 15 {
		local controls_tfull`bracket'
		}
		
	foreach bracket in 01 05 15 {
		foreach var in treatfull {
			local `var'_`bracket'_controls
			}
		}

	* We populate the local we created for mortality
		
	foreach bracket in 01 05 15 {
		foreach var of local e_controls_noprefix {
			local controls_tfull`bracket' `controls_tfull`bracket'' c_tfull`bracket'_`var'
			}
		}
		
		
	foreach bracket in 01 05 15 {
		foreach treat in treatfull {
			foreach var of local e_controls_noprefix {
				local `treat'_`bracket'_controls ``treat'_`bracket'_controls' c_`treat'`bracket'_`var'
				}
			}
		}
		
	* We regress the results at midline for the full bracket
	
	local var treatfull
	
	* Full treatment
	
	* Mortrate HC level (endline)
	
	local y = 7
	foreach x in `indices_hc' {
		areg  e_`x' `var' b_`x' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		estimates store me`y'
		
		local n_1e_`x' = string(`e(N)',"%9.0fc")
		local r2_1e_`x' = string(`e(r2)',"%9.3fc")
		local est_1e_`x' = string(_b[`var'],"%9.3fc")
		local se_1e_`x' = string(_se[`var'],"%9.3fc")
		local p_1e_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		local p_`y'e = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1e_1s_`x' = (`p_1e_`x''<=0.1 & `p_1e_`x''>0.05)
		gen s_1e_2s_`x' = (`p_1e_`x''<=0.05 & `p_1e_`x''>0.01)
		gen s_1e_3s_`x' = (`p_1e_`x''<=0.01 & `p_1e_`x''>=0)
	
		if s_1e_1s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''*"
				}
				
		if s_1e_2s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''**"
				}
				
		if s_1e_3s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''***"
				}
		
		local est_2e_`x' = string(_b[_cons],"%9.3fc")
		local se_2e_`x' = string(_se[_cons],"%9.3fc")
		local p_2e_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_2e_1s_`x' = (`p_2e_`x''<=0.1 & `p_2e_`x''>0.05)
		gen s_2e_2s_`x' = (`p_2e_`x''<=0.05 & `p_2e_`x''>0.01)
		gen s_2e_3s_`x' = (`p_2e_`x''<=0.01 & `p_2e_`x''>=0)
	
		if s_2e_1s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''*"
				}
				
		if s_2e_2s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''**"
				}
				
		if s_2e_3s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''***"
				}
				
		test treatfull = 0
		local f_walde_`x' = string(`r(p)',"%9.3fc")
				
		}
	
	
	* We create the coeffplot
	
	coefplot (me4 \ me5 \ me1 \ me2 \ me3 \ me6 \ me7), keep(`var') xline(0, lcolor(gray)) scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) xtick(-.4 -.2 0 .2 .4) xlabel(-.4 -.2 0 .2 .4) aseq swapnames coeflabels(me1 = "Utilization" me2 = "Treatment quality" me3 = "Patient satisfaction" me4 = "Citizen monitoring" me5 = "Perceived citizen pressure" me6 = "Health outcomes" me7 = "Child mortality")  note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/Figure3.png", replace
	
	*****************************************************
	* Table I1: Main outcomes: Averaged z-score indices *
	*****************************************************
	
	* Endline
	
	local pse `p_1e'
	forvalues x = 2/`y' {
		local pse `pse' \ `p_`x'e'
		}

	matrix mat = (`pse')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat pse_mat = mat'
	
	mat list pse_mat
	
	local pse_rank
	
	forvalues z = 1/`y' {
		local x = pse_mat[1,`z']
		local pse_rank `pse_rank' `x'
		}
		
	di "`pse_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y'
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local pse_rank {
		local z = `z' + 1 
		local adj_p`z'e = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'e' >= `adj_p`v'e' {
				local adj_p`z'e `adj_p`v'e'
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local pse_rank {
		local z = `z' + 1 
		forvalues j = 1/`y' {
			if `i' == `p_`j'e' { 
			local adj_pe`j' = string(`adj_p`z'e',"%9.3fc")
			}
		}
		}
	
	* We create the tables concerning the results of the main indices
	
	texdoc init "${tables}/TableI1.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \footnotesize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Main outcomes - Full treatment}
	tex \begin{tabular}{lgggggggg}
	tex \toprule
	tex 											  & (1)                       & (2)                                                          & (3)                                                             & (4)                                                        & (5)  & (6) & (7)                       \\
    tex \multirow{-2}{*}{}                              & \textbf{\begin{tabular}[c]{@{}c@{}}Citizen \\ monitoring\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Perceived citizen \\ pressure\end{tabular}}  & \textbf{Utilization}      & \textbf{\begin{tabular}[c]{@{}c@{}}Treatment \\ quality\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Patient \\ satisfaction\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Health \\ outcomes\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Child \\ mortality\end{tabular}}        \\
	tex \midrule
	tex \multirow{2}{*}{Full treatment}  & `est_1e_commtg_z' & `est_1e_h_ctzpressure_z' & `est_1e_urate_z'           & `est_1e_treatqual_z'                                                            & `est_1e_patsat_z'                                                              & `est_1e_healthout_z'                                                          & `est_1e_mortrate_05'         \\
	tex  & (`se_1e_commtg_z') & (`se_1e_h_ctzpressure_z') & (`se_1e_urate_z')           & (`se_1e_treatqual_z')                                                            & (`se_1e_patsat_z')                                                              & (`se_1e_healthout_z')                                                         & (`se_1e_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}  & `est_2e_commtg_z' & `est_2e_h_ctzpressure_z' & `est_2e_urate_z'           & `est_2e_treatqual_z'                                                            & `est_2e_patsat_z'                                                              & `est_2e_healthout_z'                                                          & `est_2e_mortrate_05'         \\
	tex  & (`se_2e_commtg_z') & (`se_2e_h_ctzpressure_z') & (`se_2e_urate_z')           & (`se_2e_treatqual_z')                                                            & (`se_2e_patsat_z')                                                               & (`se_2e_healthout_z')                                                          & `se_2e_mortrate_05'         \\
	tex \midrule
	tex \multirow{1}{*}{N} & `n_1e_commtg_z'  & `n_1e_h_ctzpressure_z' & `n_1e_urate_z'           & `n_1e_treatqual_z'                                                            & `n_1e_patsat_z'                                                            & `n_1e_healthout_z'                                                          & `n_1e_mortrate_05'         \\
	tex \multirow{1}{*}{R$^{2}$}   & `r2_1e_commtg_z'  & `r2_1e_h_ctzpressure_z' & `r2_1e_urate_z'           & `r2_1e_treatqual_z'                                                           & `r2_1e_patsat_z'                                                             & `r2_1e_healthout_z'                                                         & `r2_1e_mortrate_05'         \\
	tex \multirow{1}{*}{P-value (Full treatment = 0)}   & `f_walde_commtg_z'  & `f_walde_h_ctzpressure_z'  & `f_walde_urate_z'           & `f_walde_treatqual_z'                                                            & `f_walde_patsat_z'                                                              & `f_walde_healthout_z'                                                          & `f_walde_mortrate_05'         \\
	tex \multirow{2}{*}{Adjusted p-value (FT)}   & `adj_pe4'  & `adj_pe5' & `adj_pe1'           & `adj_pe2'                                                            & `adj_pe3'                                                              & `adj_pe6'                                                          & `adj_pe7'         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	*************************************************************************************
	* Figure 4: Treatment effects on outcome indices and their subcomponents at endline *
	*************************************************************************************
	
	*****
	* & *
	*****
	
	*******************************************************
	* Figure 7: Quantile regressions of treatment effects *
	*******************************************************
	
	local var treatfull
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	local indices urate_z treatqual_z patsat_z commtg_z
	local indices_ho healthout_z
	local indices_hc mortrate_05 h_ctzpressure_z
	
	***********************
	* Quantile regression *
	***********************
	
	eststo clear
	
	local var treatfull
	
	* Main indices 
	
	local z = 0
	foreach x in `indices' {
		
		local z = `z' + 1
		
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local est_`x' = _b[`var']
		estimates store m`z'
		
		forvalues y = 1/9 {
			xi: qreg2 e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls' i.district, q(.`y') cl(hc_id)
			estimates store m`z'_`y'
			}
		}

	
	coefplot (m1_1 \ m1_2 \ m1_3 \ m1_4 \ m1_5 \ m1_6 \ m1_7 \ m1_8 \ m1_9), keep(`var') yline(0, lcolor(gray)) yline(`est_urate_z', lcolor(red)) vertical scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) ytick(-.4 -.2 0 .2 .4) ylabel(-.4 -.2 0 .2 .4) aseq swapnames coeflabels(m1_1 = "0.1" m1_2 = "0.2" m1_3 = "0.3" m1_4 = "0.4" m1_5 = "0.5" m1_6 = "0.6" m1_7 = "0.7" m1_8 = "0.8" m1_9 = "0.9")   subtitle("Quantile regression: Utilization index") b1title("Quantile") l1title("Utilization index") note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/Figure7c_utilization.png", replace

	coefplot (m2_1 \ m2_2 \ m2_3 \ m2_4 \ m2_5 \ m2_6 \ m2_7 \ m2_8 \ m2_9), keep(`var') yline(0, lcolor(gray)) yline(`est_treatqual_z', lcolor(red)) vertical scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) ytick(-.4 -.2 0 .2 .4) ylabel(-.4 -.2 0 .2 .4) aseq swapnames coeflabels(m2_1 = "0.1" m2_2 = "0.2" m2_3 = "0.3" m2_4 = "0.4" m2_5 = "0.5" m2_6 = "0.6" m2_7 = "0.7" m2_8 = "0.8" m2_9 = "0.9")   subtitle("Quantile regression: Treatment quality index") b1title("Quantile") l1title("Treatment quality index") note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/Figure7d_treatqual.png", replace

	coefplot (m3_1 \ m3_2 \ m3_3 \ m3_4 \ m3_5 \ m3_6 \ m3_7 \ m3_8 \ m3_9), keep(`var') yline(0, lcolor(gray)) yline(`est_patsat_z', lcolor(red)) vertical scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) ytick(-.4 -.2 0 .2 .4) ylabel(-.4 -.2 0 .2 .4) aseq swapnames coeflabels(m3_1 = "0.1" m3_2 = "0.2" m3_3 = "0.3" m3_4 = "0.4" m3_5 = "0.5" m3_6 = "0.6" m3_7 = "0.7" m3_8 = "0.8" m3_9 = "0.9")   subtitle("Quantile regression: Patient satisfaction index") b1title("Quantile") l1title("Patient satisfaction index") note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/Figure7e_patsat.png", replace
	
	coefplot (m4_1 \ m4_2 \ m4_3 \ m4_4 \ m4_5 \ m4_6 \ m4_7 \ m4_8 \ m4_9), keep(`var') yline(0, lcolor(gray)) yline(`est_commtg_z', lcolor(red)) vertical scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) ytick(-.4 -.2 0 .2 .4) ylabel(-.4 -.2 0 .2 .4) aseq swapnames coeflabels(m4_1 = "0.1" m4_2 = "0.2" m4_3 = "0.3" m4_4 = "0.4" m4_5 = "0.5" m4_6 = "0.6" m4_7 = "0.7" m4_8 = "0.8" m4_9 = "0.9")   subtitle("Quantile regression: Citizen monitoring index") b1title("Quantile") l1title("Citizen monitoring index") note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/Figure7a_ctzmonitoring.png", replace

	eststo clear
	
	* Health outcome 
	
	local z = 0
	foreach x in `indices_ho' {
		local z = `z' + 1
		
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull_hoe' `tfulli_hoe_e_controls', robust cl(hc_id) a(district)
		
		local est_`x' = _b[`var']
		
		forvalues y = 1/9 {
			xi: qreg2 e_`x' `var' b_`x' b_`x'_d `e_controls_tfull_hoe' `tfulli_hoe_e_controls' i.district, q(.`y') cl(hc_id)
			estimates store m`z'_`y'
			}
		}
	
	coefplot (m1_1 \ m1_2 \ m1_3 \ m1_4 \ m1_5 \ m1_6 \ m1_7 \ m1_8 \ m1_9), keep(`var') yline(0, lcolor(gray)) yline(`est_healthout_z', lcolor(red)) vertical scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) ytick(-.4 -.2 0 .2 .4) ylabel(-.4 -.2 0 .2 .4) aseq swapnames coeflabels(m1_1 = "0.1" m1_2 = "0.2" m1_3 = "0.3" m1_4 = "0.4" m1_5 = "0.5" m1_6 = "0.6" m1_7 = "0.7" m1_8 = "0.8" m1_9 = "0.9")   subtitle("Quantile regression: Health outcomes index") b1title("Quantile") l1title("Health outcomes index") note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/Figure7f_healthoutcome.png", replace

	eststo clear
	
	* Child mortality 
	
	local z = 0
	foreach x in `indices_hc' {
		local z = `z' + 1
		
		areg  e_`x' `var' b_`x'  `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		local est_`x' = _b[`var']
		
		forvalues y = 1/9 {
			xi: qreg2 e_`x' `var' b_`x' `e_controls_tfull_hc' ``var'_hc_int_e_controls' i.district if uniquehc == 1, q(.`y') cl(hc_id)
			estimates store m`z'_`y'
			}
		}
	
	coefplot (m1_1 \ m1_2 \ m1_3 \ m1_4 \ m1_5 \ m1_6 \ m1_7 \ m1_8 \ m1_9), keep(`var') yline(0, lcolor(gray)) yline(`est_healthout_z', lcolor(red)) vertical scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) ytick(-.4 -.2 0 .2 .4) ylabel(-.4 -.2 0 .2 .4) aseq swapnames coeflabels(m1_1 = "0.1" m1_2 = "0.2" m1_3 = "0.3" m1_4 = "0.4" m1_5 = "0.5" m1_6 = "0.6" m1_7 = "0.7" m1_8 = "0.8" m1_9 = "0.9")   subtitle("Quantile regression: Child mortality") b1title("Quantile") l1title("Child mortality (0-5)") note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/Figure7g_childmortality.png", replace
	
	coefplot (m2_1 \ m2_2 \ m2_3 \ m2_4 \ m2_5 \ m2_6 \ m2_7 \ m2_8 \ m2_9), keep(`var') yline(0, lcolor(gray)) yline(`est_h_ctzpressure_z', lcolor(red)) vertical scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) ytick(-.8 -.6 -.4 -.2 0 .2 .4) ylabel(-.8 -.6 -.4 -.2 0 .2 .4) aseq swapnames coeflabels(m2_1 = "0.1" m2_2 = "0.2" m2_3 = "0.3" m2_4 = "0.4" m2_5 = "0.5" m2_6 = "0.6" m2_7 = "0.7" m2_8 = "0.8" m2_9 = "0.9")   subtitle("Quantile regression: Perceived citizen pressure index") b1title("Quantile") l1title("Perceived citizen pressure index") note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/Figure7b_ctzpressure.png", replace

	
	**********************
	* Table Main outcome *
	**********************
	
	*************************************
	* Table/Figure Community monitoring *
	*************************************
	
	* At endline
	
	eststo clear
	
	local y = 1
	foreach x in `commmonitoring' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}

	local y = 4
	foreach x in `commmonitoring_nobaseline' {
		areg  e_`x' `var' `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}
		
	* We create the adjusted p-value following the Benjamini-Hochberg methodology 
	
	local y = 5
	
	local ps `p_2'
	forvalues x = 3/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y' - 1
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 2/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}	
	
	* We include the adjusted p-value from the main outcomes index
	
	estimates restore m1
	estadd scalar adj_p = 0.900
	
	*************************************
	* Table Comm mon outcomes (endline) *
	*************************************
	
	coefplot (m1 \ m2 \ m3 \ m4 \ m5), keep(`var') xline(0, lcolor(gray)) scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) xtick(-.4 -.2 0 .2 .4) xlabel(-.4 -.2 0 .2 .4) aseq swapnames coeflabels(m1 = "{bf:Citizen monitoring index}" m2 = "Attended LC1 meetings" m3 = "HC discussed at LC1 meetings" m4 = "Community would find out: staff late" m5 = "Community would find out: staff no effort")  note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/Figure4a_ctzmonitoring.png", replace
	
	
	# delimit;
	
	esttab m1 m2 m3 m4 m5
	using "${tables}/TableI2.tex", b(%5.3f) se(%5.3f)
		title(Community monitoring index -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Community\\monitoring\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Attended\\LC1 meetings\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}HC discussed\\at LC1 meetings\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Community\\would find out:\\staff late\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Community\\would find out:\\staff no effort\end{tabular}")
		stats(N r2 adj_p, labels("N" "R$^{2}$" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	********************
	* Non standardized *
	********************
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `commmonitoring_ns' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		qui sum e_`x' if `var' == 0
		local meane_`x' r(mean)
		local meane_`x' = string(`meane_`x'',"%9.3fc")
		
		estadd scalar meane = `meane_`x''
		
		qui sum b_`x' if `var' == 0
		local meanb_`x' r(mean)
		local meanb_`x' = string(`meanb_`x'',"%9.3fc")
		
		estadd scalar meanb = `meanb_`x''
		
		estimates store m`y'
		
		local y = `y' + 1
		
		}
		
	local y = 4
	foreach x in `commmonitoring_nobaseline_ns' {
		areg  e_`x' `var' `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		qui sum e_`x' if `var' == 0
		local meane_`x' r(mean)
		local meane_`x' = string(`meane_`x'',"%9.3fc")
		
		estadd scalar meane = `meane_`x''
		
		estimates store m`y'
		
		local y = `y' + 1
		
		}
	
	# delimit;
	
	esttab m1 m2 m3 m4 m5
	using "${tables}/TableI3.tex", b(%5.3f) se(%5.3f)
		title(Citizen monitoring index non-standardized -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Citizen\\monitoring\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Attended\\LC1 meetings\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}HC discussed\\at LC1 meetings\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Community\\would find out:\\staff late\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Community\\would find out:\\staff no effort\end{tabular}")
		stats(N r2 meane meanb, labels("N" "R$^{2}$" "Mean control group endline" "Mean control group baseline") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr

	*********************************
	* Table/Figure Citizen pressure *
	*********************************
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `ctzpressure_z' {
		areg  e_`x' `var' b_`x' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}
		
	foreach x in `ctzpressure_nobase' {
		areg  e_`x' `var' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}
		
	* We create the adjusted p-value following the Benjamini-Hochberg methodology 
	
	local y = `y' - 1
	
	local ps `p_2'
	forvalues x = 3/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y' - 1
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 2/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}	
		
	* We include the adjusted p-value from the main outcomes index
	
	estimates restore m1
	estadd scalar adj_p = 0.298
	
	********************************************
	* Table Citizen pressure outcomes (endline) *
	********************************************
		
	coefplot (m1 \ m2 \ m3 \ m4), keep(`var') xline(0, lcolor(gray)) scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) xtick(-.4 -.2 0 .2 .4) xlabel(-.4 -.2 0 .2 .4) aseq swapnames coeflabels(m1 = "{bf:Perceived citizen pressure index}" m2 = "Community would find out: staff no effort" m3 = "Community would find out: staff absent" m4 = "Any report of staff wrongdoing in past 12 months") note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/Figure4b_ctzpressure.png", replace
	
	# delimit;
	
	esttab m1 m2 m3 m4
	using "${tables}/TableI4.tex", b(%5.3f) se(%5.3f)
		title(Perceived citizen pressure index (endline) -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\begin{tabular}[c]{@{}c@{}}Perceived citizen pressure\\index\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Community would find out:\\ staff no effort\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Community would find out:\\ staff absent\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Any report of staff wrongdoing\\ in past 12 months\end{tabular}")
		stats(N r2 adj_p, labels("N" "R$^{2}$" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	********************
	* Non standardized *
	********************
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `ctzpressure_ns' {
		areg e_`x' `var' b_`x' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		qui sum e_`x' if `var' == 0
		local meane_`x' r(mean)
		local meane_`x' = string(`meane_`x'',"%9.3fc")
		
		qui sum b_`x' if `var' == 0
		local meanb_`x' r(mean)
		local meanb_`x' = string(`meanb_`x'',"%9.3fc")
		
		estadd scalar meanb = `meanb_`x''
		estadd scalar meane = `meane_`x''
	
		estimates store m`y'
		
		local y = `y' + 1
		
		}
		
	local y = 4
	foreach x in `ctzpressure_nobase_ns' {
		areg  e_`x' `var' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		qui sum e_`x' if `var' == 0
		local meane_`x' r(mean)
		local meane_`x' = string(`meane_`x'',"%9.3fc")
		
		estadd scalar meane = `meane_`x''
		
		estimates store m`y'
		
		}
	
	# delimit;
	
	esttab m1 m2 m3 m4
	using "${tables}/TableI5.tex", b(%5.3f) se(%5.3f)
		title(Perceived citizen pressure index non-standardized -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Perceived\\citizen\\pressure\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Community\\would find out:\\staff no effort\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Community\\would find out:\\staff absent\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Any report\\of staff\\wrongdoing\\ in past 12 months\end{tabular}")
		stats(N r2 meane meanb, labels("N" "R$^{2}$" "Mean control group endline" "Mean control group baseline") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
			
	****************************
	* Table/Figure Utilization *
	****************************
	
	* We work on the coefficient plot for the utilization indice
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `utilization' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}
		
	local y = 4
	foreach x in `utilization_vacc' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull_vace'  `tfulli_vace_e_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		}
		
	* We create the adjusted p-value following the Benjamini-Hochberg methodology 
	
	local ps `p_2'
	forvalues x = 3/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y' - 1
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 2/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}
		
	* We include the adjusted p-value from the main outcomes index
	
	estimates restore m1
	estadd scalar adj_p = 0.298
	
	****************************************
	* Table Utilization outcomes (endline) *
	****************************************
	
	coefplot (m1 \ m4 \ m2 \ m3), keep(`var') xline(0, lcolor(gray)) scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) xtick(-.4 -.2 0 .2 .4) xlabel(-.4 -.2 0 .2 .4) aseq swapnames coeflabels(m1 = "{bf:Utilization index}" m4 = "Vaccination rates, children < 36 months" m2 = "% of visits to HC vs other providers" m3 = "Number of visits to HC") note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/Figure4c_utilization.png", replace
	
	# delimit;
	
	esttab m1 m4 m2 m3
	using "${tables}/TableI6.tex", b(%5.3f) se(%5.3f)
		title(Utilization index -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Utilization\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Vaccination rates,\\children\textless 36 months\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}\% of visits to HC,\\vs. other providers\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Number of visits\\ to HC\end{tabular}")
		stats(N r2 adj_p, labels("N" "R$^{2}$" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	********************
	* Non standardized *
	********************
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `utilization_ns' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)

		qui sum e_`x' if `var' == 0
		local meane_`x' r(mean)
		local meane_`x' = string(`meane_`x'',"%9.3fc")
		
		qui sum b_`x' if `var' == 0
		local meanb_`x' r(mean)
		local meanb_`x' = string(`meanb_`x'',"%9.3fc")
		
		estadd scalar meanb = `meanb_`x''
		estadd scalar meane = `meane_`x''
		
		estimates store m`y'
		
		local y = `y' + 1
		}
		
	local y = 4
	foreach x in `utilization_vacc_ns' {
		areg  e_`x' `var' b_`x' `e_controls_tfull_vace'  `tfulli_vace_e_controls', robust cl(hc_id) a(district)
		
		qui sum e_`x' if `var' == 0
		local meane_`x' r(mean)
		local meane_`x' = string(`meane_`x'',"%9.3fc")
		
		qui sum b_`x' if `var' == 0
		local meanb_`x' r(mean)
		local meanb_`x' = string(`meanb_`x'',"%9.3fc")
		
		estadd scalar meanb = `meanb_`x''
		estadd scalar meane = `meane_`x''
		
		estimates store m`y'
		
		}
	
	# delimit;
	
	esttab m1 m4 m2 m3
	using "${tables}/TableI7.tex", b(%5.3f) se(%5.3f)
		title(Utilization index non-standardized -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Utilization\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Vaccination rates,\\children\textless 36 months\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}\% of visits to HC,\\vs. other providers\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Number of visits\\ to HC\end{tabular}")
		stats(N r2 meane meanb, labels("N" "R$^{2}$" "Mean control group endline" "Mean control group baseline") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	**********************************
	* Table/Figure Treatment quality *
	**********************************
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `treatmentqual' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}
		
	local y = 8
	foreach x in `treatmentqual_hclevel' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1 , robust a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}
		
	* We create the adjusted p-value following the Benjamini-Hochberg methodology 
	
	local y = `y' - 1

	local ps `p_2'
	forvalues x = 3/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y' - 1
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 2/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}	
		
	* We include the adjusted p-value from the main outcomes index
	
	estimates restore m1
	estadd scalar adj_p = 0.028
	
	**********************************************
	* Table Treatment quality outcomes (endline) *
	**********************************************
	
	coefplot (m1 \ m2 \ m3 \ m4 \ m5 \ m6 \ m7 \ m8 \ m9 \ m10), keep(`var') xline(0, lcolor(gray)) scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) xtick(-.4 -.2 0 .2 .4) xlabel(-.4 -.2 0 .2 .4) aseq swapnames coeflabels(m1 = "{bf:Treatment quality index}" m2 = "Used equipment" m3 = "Waiting time" m4 = "Examined by trained staff" m5 = "Privacy during exam" m6 = "Received test when needed" m7 = "Diagnosis explained clearly" m8 = "% staff presence" m9 = "Facility cleanliness" m10 = "Drug availabilty")  note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/Figure4d_treatqual.png", replace
	
	
	# delimit;
	
	esttab m1 m2 m3 m4 m5 m6 m7 m8 m9 m10
	using "${tables}/TableI8.tex", b(%5.3f) se(%5.3f)
		title(Treatment quality index -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Treatment\\quality\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Used\\equipment\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Waiting\\time\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Examined\\by trained\\staff\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Privacy\\during\\exam\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Received\\test when\\needed\end{tabular} "
				"\begin{tabular}[c]{@{}c@{}}Diagnosis\\explained\\clearly\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}\% staff\\presence\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Facility\\cleanliness\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Drug\\availability\end{tabular}")
		stats(N r2 adj_p, labels("N" "R$^{2}$" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	********************
	* Non standardized *
	********************
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `treatmentqual_ns' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		estimates store m`y'
		
		qui sum e_`x' if `var' == 0
		local meane_`x' r(mean)
		local meane_`x' = string(`meane_`x'',"%9.3fc")
		
		qui sum b_`x' if `var' == 0
		local meanb_`x' r(mean)
		local meanb_`x' = string(`meanb_`x'',"%9.3fc")
		
		estadd scalar meanb = `meanb_`x''
		estadd scalar meane = `meane_`x''
		
		local y = `y' + 1
		}
		
	local y = 8
	foreach x in `treatmentqual_hclevel_ns' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1 , robust a(district)
	
		estimates store m`y'
		
		qui sum e_`x' if `var' == 0
		local meane_`x' r(mean)
		local meane_`x' = string(`meane_`x'',"%9.3fc")
		
		qui sum b_`x' if `var' == 0
		local meanb_`x' r(mean)
		local meanb_`x' = string(`meanb_`x'',"%9.3fc")
		
		estadd scalar meanb = `meanb_`x''
		estadd scalar meane = `meane_`x''
		
		local y = `y' + 1
		}
		
	# delimit;
	
	esttab m1 m2 m3 m4 m5 m6 m7 m8 m9 m10
	using "${tables}/TableI9.tex", b(%5.3f) se(%5.3f)
		title(Treatment quality index non-standardized -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Treatment\\quality\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Used\\equipment\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Waiting\\time\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Examined\\by trained\\staff\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Privacy\\during\\exam\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Received\\test when\\needed\end{tabular} "
				"\begin{tabular}[c]{@{}c@{}}Diagnosis\\explained\\clearly\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}\% staff\\presence\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Facility\\cleanliness\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Drug\\availability\end{tabular}")
		stats(N r2 meane meanb, labels("N" "R$^{2}$" "Mean control group endline" "Mean control group baseline") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	******************************************************************************
	* Table I33: Robustness check – Excluding subcomponents of treatment quality *
	******************************************************************************
	
	* At endline:
	
	local treatmentqual_w treatqual_w1_z treatqual_w2_z treatqual_w3_z treatqual_w4_z treatqual_w5_z treatqual_w6_z treatqual_w7_z treatqual_w8_z treatqual_w9_z
	
	eststo clear
	
	local y = 1
	foreach x in `treatmentqual_w' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		estimates store m`y'
		local y = `y' + 1
		}
	
	# delimit;
	
	esttab m1 m2 m3 m4 m5 m6 m7 m8 m9
	using "${tables}/TableI33.tex", b(%5.3f) se(%5.3f)
		title(Robustness check treatment quality subcomponents by subcomponents (endline))
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\begin{tabular}[c]{@{}c@{}}Treatment\\quality\\wo/ used\\equipment\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Treatment\\quality\\wo/ waiting\\time\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Treatment\\quality\\wo/ examined \\ by trained \\staff\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Treatment\\quality\\wo/ privacy \\during exam\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Treatment\\quality\\wo/ received\\ test \\when needed\end{tabular} "
				"\begin{tabular}[c]{@{}c@{}}Treatment\\quality\\wo/ diagnosis \\explained\\ clearly\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Treatment\\quality\\wo/ \% staff \\presence\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Treatment\\quality\\wo/ facility \\cleanliness\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Treatment\\quality\\wo/ drug \\availability\end{tabular}")
		stats(N r2, labels("N" "R$^{2}$") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	*************************************
	* Table/Figure Patient satisfaction *
	*************************************
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `patsat' {
		areg e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}
		
	local y = 8
	foreach x in `patsat_nobaseline' {
		areg e_`x' `var' `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		}

	* We create the adjusted p-value following the Benjamini-Hochberg methodology 

	local ps `p_2'
	forvalues x = 3/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y' - 1
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 2/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}	
		
	* We include the adjusted p-value from the main outcomes index
	
	estimates restore m1
	estadd scalar adj_p = 0.010
	
	*************************************************
	* Table Patient satisfaction outcomes (endline) *
	*************************************************
	
	coefplot (m1 \ m8 \ m2 \ m3 \ m4 \ m5 \ m6 \ m7 ), keep(`var') xline(0, lcolor(gray)) scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) xtick(-.4 -.2 0 .2 .4) xlabel(-.4 -.2 0 .2 .4) aseq swapnames coeflabels(m1 = "{bf:Patient satisfaction index}" m8 = "Satisfied by health centre quality" m2 = "Satisfied with quality of care" m3 = "Polite staff" m4 = "Staff interested in their health" m5 = "Staff listening" m6 = "Free to express" m7 = "Availability of staff improving")  note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/Figure4e_patsat.png", replace
	
	# delimit;
	
	esttab m1 m8 m2 m3 m4 m5 m6 m7
	using "${tables}/TableI10.tex", b(%5.3f) se(%5.3f)
		title(Patient satisfaction index -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Patient\\satisfaction\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Satisfied by\\HC quality\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Satisfied\\with quality\\of care\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Polite\\staff\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Staff\\interested\\in health\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Staff\\listening\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Free to\\express\\clearly\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}} Availability\\of staff\\improving\end{tabular}")
		stats(N r2 adj_p, labels("N" "R$^{2}$" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	********************
	* Non standardized *
	********************
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `patsat_ns' {
		areg e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		estimates store m`y'
		
		qui sum e_`x' if `var' == 0
		local meane_`x' r(mean)
		local meane_`x' = string(`meane_`x'',"%9.3fc")
		
		qui sum b_`x' if `var' == 0
		local meanb_`x' r(mean)
		local meanb_`x' = string(`meanb_`x'',"%9.3fc")
		
		estadd scalar meanb = `meanb_`x''
		estadd scalar meane = `meane_`x''
	
		local y = `y' + 1
		}
		
	local y = 8
	foreach x in `patsat_nobaseline_ns' {
		areg e_`x' `var' `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		estimates store m`y'
		
		qui sum e_`x' if `var' == 0
		local meane_`x' r(mean)
		local meane_`x' = string(`meane_`x'',"%9.3fc")
		
		estadd scalar meane = `meane_`x''
		
		}
	
	# delimit;
	
	esttab m1 m8 m2 m3 m4 m5 m6 m7
	using "${tables}/TableI11.tex", b(%5.3f) se(%5.3f)
		title(Patient satisfaction index non-standardized -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Patient\\satisfaction\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Satisfied by\\HC quality\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Satisfied\\with quality\\of care\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Polite\\staff\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Staff\\interested\\in health\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Staff\\listening\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Free to\\express\\clearly\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}} Availability\\of staff\\improving\end{tabular}")
		stats(N r2 meane meanb, labels("N" "R$^{2}$" "Mean control group endline" "Mean control group baseline") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	********************************
	* Table/Figure Health outcomes *
	********************************
	
	* We load the proper dataset
	
	use "${usedata}/healthoutcome_endline_ind.dta", clear
	
	* Regressions at endline
	
	* We regress the main outcomes

	areg  e_healthoutcome_z treatfull b_healthoutcome_z b_healthoutcome_z_d `controls_tfull' `treatfull_controls', robust cl(hc_id) a(district) 
	
	estimates store m1
	
	* We take care of the different cohort
	
	local z = 1
		foreach y in _weight18_z  _muac18_z {
			local z = `z' + 1
			areg  e`y' treatfull b`y' b`y'_d `controls_tfullho1' `treatfull_ho1_controls', robust cl(hc_id) a(district) 
			estimates store m`z'
			
			local p_`z' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		}
		
	local z = 3
		foreach y in _weight36_z  _muac36_z {
			local z = `z' + 1
			areg  e`y' treatfull b`y' b`y'_d `controls_tfullho2' `treatfull_ho2_controls', robust cl(hc_id) a(district) 
			estimates store m`z'
			
			local p_`z' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		}
		
		
	* We create the adjusted p-value following the Benjamini-Hochberg methodology 
	
	local y = 5
	
	local ps `p_2'
	forvalues x = 3/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y' - 1
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 2/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}
		
		
	* We include the adjusted p-value from the main outcomes index
	
	estimates restore m1
	estadd scalar adj_p = 0.900
	
	***********************************
	* Table Health outcomes (endline) *
	***********************************
	
	* Outsheet the coefplot
		
	coefplot (m1 \ m2 \ m3 \ m4 \ m5), keep(treatfull) xline(0, lcolor(gray)) scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) xtick(-.4 -.2 0 .2 .4) xlabel(-.4 -.2 0 .2 .4) aseq swapnames coeflabels(m1 = "{bf:Health outcomes index}" m2 = "Weight for age, 0-18 months" m3 = "Weight for age, 18-36 months" m4 = "MUAC, 0-18 months" m5 = "MUAC, 18-36 months")  note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/figure4f_healthoutcome.png", replace
	
	
	* We outsheet the tables
	
	# delimit;
	
	esttab m1 m2 m3 m4 m5
	using "${tables}/TableI12.tex", b(%5.3f) se(%5.3f)
		title(Health outcome at the child level -- Averaged z-score indices)
		keep(treatfull _cons)
		varlabels (treatfull "Full treatment" _cons "Constant")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Health outcomes\\index\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Weight/Age\\0-18 months\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}MUAC\\0-18 months\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Weight/Age\\18-36 months\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}MUAC\\18-36 months\end{tabular}}")
		stats(N r2 adj_p, labels("N" "R$^{2}$" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
		
	* Regressions at endline (NS)

	eststo clear
	
	* We regress the main indicators
	
	areg  e_healthoutcome_z treatfull b_healthoutcome_z b_healthoutcome_z_d `controls_tfull' `treatfull_controls', robust cl(hc_id) a(district) 
	estimates store m1
	
	qui sum e_healthoutcome_z if treatfull == 0
	local meane_healthoutcome_z r(mean)
	local meane_healthoutcome_z = string(`meane_healthoutcome_z',"%9.3fc")
	
	qui sum b_healthoutcome_z if treatfull == 0
	local meanb_healthoutcome_z r(mean)
	local meanb_healthoutcome_z = string(`meanb_healthoutcome_z',"%9.3fc")
	
	estadd scalar meanb = `meanb_healthoutcome_z'
	estadd scalar meane = `meane_healthoutcome_z'
	
	* We take care of the different cohort
	
	local z = 1
		foreach y in _weight18  _muac18 {
			local z = `z' + 1
			areg  e`y' treatfull b`y' b`y'_d `controls_tfullho1' `treatfull_ho1_controls', robust cl(hc_id) a(district) 
			estimates store m`z'
			
			local p_`z' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
			qui sum e`y' if treatfull == 0
			local meane`y' r(mean)
			local meane`y' = string(`meane`y'',"%9.3fc")
			
			qui sum b`y' if treatfull == 0
			local meanb`y' r(mean)
			local meanb`y' = string(`meanb`y'',"%9.3fc")
			
			estadd scalar meanb = `meanb`y''
			estadd scalar meane = `meane`y''
	
			
		}
		
	local z = 3
		foreach y in _weight36  _muac36 {
			local z = `z' + 1
			areg  e`y' treatfull b`y' b`y'_d `controls_tfullho2' `treatfull_ho2_controls', robust cl(hc_id) a(district) 
			estimates store m`z'
			
			local p_`z' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
			qui sum e`y' if treatfull == 0
			local meane`y' r(mean)
			local meane`y' = string(`meane`y'',"%9.3fc")
			
			qui sum b`y' if treatfull == 0
			local meanb`y' r(mean)
			local meanb`y' = string(`meanb`y'',"%9.3fc")
			
			estadd scalar meanb = `meanb`y''
			estadd scalar meane = `meane`y''
			
		}
	
	* We outsheet the results
	
	# delimit;
	
	esttab m1 m2 m3 m4 m5
	using "${tables}/TableI13.tex", b(%5.3f) se(%5.3f)
		title(Health outcome at the child level -- Non-standardized subcomponents)
		keep(treatfull _cons)
		varlabels (treatfull "Full treatment" _cons "Constant")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Health outcome\\overall\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Weight/Age\\0-18 months\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}MUAC\\0-18 months\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Weight/Age\\18-36 months\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}MUAC\\18-36 months\end{tabular}}")
		stats(N r2 meane meanb, labels("N" "R$^{2}$" "Mean control group endline" "Mean control group baseline") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	********************************
	* Table/Figure Child mortality *
	********************************
	
	* We load the right dataset
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `childmortality' {
		areg  e_`x' `var' b_`x' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}
	
	* We create the adjusted p-value following the Benjamini-Hochberg methodology 
	
	local y = `y' - 1
	
	local ps `p_2'
	forvalues x = 3/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y' - 1
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 2/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}	
		
	* We include the adjusted p-value from the main outcomes index
	
	estimates restore m1
	estadd scalar adj_p = 0.298
		
	********************************************
	* Table Child mortality outcomes (endline) *
	********************************************
	
	coefplot (m1 \ m2 \ m3), keep(`var') xline(0, lcolor(gray)) scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) xtick(-.04 -.02 0 .02 .04) xlabel(-.04 -.02 0 .02 .04) aseq swapnames coeflabels(m1 = "Child mortality, 0-5 years" m2 = "Child mortality, 0-12 months" m3 = "Child mortality, 1-5 years") note("Displaying 95% and 90% confidence intervals" "Note the different scale from panels (a)-(f)")
	qui graph export "${Figures}/Figure4g_childmortality.png", replace
	
	
	# delimit;
	
	esttab m1 m2 m3
	using "${tables}/TableI14.tex", b(%5.3f) se(%5.3f)
		title(Child mortality index -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\begin{tabular}[c]{@{}c@{}}Child\\mortality\\0-5 years old\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Child mortality\\0-1 year old\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Child mortality\\1-5 years old\end{tabular}")
		stats(N r2 adj_p, labels("N" "R$^{2}$" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	***************************
	** Intermediate outcomes **
	***************************

	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `intermediate' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		
		test treatfull = 0
		local f_walde_`x' = string(`r(p)',"%9.3fc")
		
		estadd scalar f_walde = `f_walde_`x''
		
		local y = `y' + 1
		}
		
	local y = 5
	foreach x in `intermediate_hclevel' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		
		test treatfull = 0
		local f_walde_`x' = string(`r(p)',"%9.3fc")
		
		estadd scalar f_walde = `f_walde_`x''
		
		local y = `y' + 1
		}
	
	* We create the adjusted p-value following the Benjamini-Hochberg methodology 
	
	local y = `y' - 1
	
	local ps `p_1'
	forvalues x = 2/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y'
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 1/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}	
		
	*****************************************
	* Table Intermediate outcomes (endline) *
	*****************************************
	
	coefplot (m1 \ m5 \ m3 \ m2 \ m6 \ m4), keep(`var') xline(0, lcolor(gray)) scheme(s1mono) mcolor(blue) mlcolor(blue) levels(95 90) ciopts(lcolor(blue blue) lwidth(medium thick)) grid(none) xtick(-.2 -.1 0 .1 .2 .3 .4) xlabel(-.2 -.1 0 .1 .2 .3 .4) aseq swapnames coeflabels(m1 = "Citizen knowledge" m5 = "HC staff knowledge" m2 = "Efficacy" m3 = "Community responsibility"  m4 = "Relationship" m6 = "HC transparency") note("Displaying 95% and 90% confidence intervals")
	qui graph export "${Figures}/Figure5.png", replace
	
	# delimit;
	
	esttab m1 m5 m2 m3 m4 m6
	using "${tables}/TableI15.tex", b(%5.3f) se(%5.3f)
		title(Intermediate outcomes -- Averaged z-score indices)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Citizen\\knowledge\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}HC staff\\knowledge\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Efficacy\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Community\\responsibility\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Relationship\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}HC\\transparency\end{tabular}}")
		stats(N r2 f_walde adj_p, labels("N" "R$^{2}$" "P-value (Full treatment = 0)" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	* We look in details to the component

	***************************
	* Table Citizen knowledge *
	***************************
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `citizenknowledge' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}
		
	local y = 4
	foreach x in `citizenknowledge_nobaseline' {
		areg  e_`x' `var' `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		}
		
	* We create the adjusted p-value following the Benjamini-Hochberg methodology 
	
	local ps `p_2'
	forvalues x = 3/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y' - 1
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 2/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}	
		
	* We include the adjusted p-value from the main outcomes index
	
	estimates restore m1
	estadd scalar adj_p = 0.104
		
	******************************************
	* Table Ctz knowledge outcomes (endline) *
	******************************************
	
	# delimit;
	
	esttab m1 m2 m3 m4
	using "${tables}/TableI16.tex", b(%5.3f) se(%5.3f)
		title(Citizen knowledge index -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Citizen\\knowledge\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}\# of patients\\rights correctly\\named\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}\# of patients\\resp. correctly\\named\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}\# of HC services\\correctly named\end{tabular}")
		stats(N r2 adj_p, labels("N" "R$^{2}$" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	*********************************
	* Table Health worker knowledge *
	*********************************
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `h_hcknowledge' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}
		
	* We create the adjusted p-value following the Benjamini-Hochberg methodology 
	
	local y = `y' - 1
	
	local ps `p_2'
	forvalues x = 3/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y' - 1
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 2/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}	
	
	* We include the adjusted p-value from the main outcomes index
	
	estimates restore m1
	estadd scalar adj_p = 0.473
	
	*****************************************
	* Table HC knowledge outcomes (endline) *
	*****************************************
		
	# delimit;
	
	esttab m1 m2 m3
	using "${tables}/TableI17.tex", b(%5.3f) se(%5.3f)
		title(HC staff knowledge index -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}HC staff\\knowledge\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}\# of patients\\rights correctly\\named\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}\# of patients\\resp. correctly\\named\end{tabular}")
		stats(N r2 adj_p, labels("N" "R$^{2}$" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	*******************
	* Tables Efficacy *
	*******************

	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `efficacy' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}
	
	local y = 6
	foreach x in `efficacy_nobaseline' {
		areg  e_`x' `var' `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}
		
	* We create the adjusted p-value following the Benjamini-Hochberg methodology 
	
	local y = `y' - 1
	
	local ps `p_2'
	forvalues x = 3/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y' - 1
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 2/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}	
		
	* We include the adjusted p-value from the main outcomes index
	
	estimates restore m1
	estadd scalar adj_p = 0.515
	
	*************************************
	* Table Efficacy outcomes (endline) *
	*************************************

	# delimit;
	
	esttab m1 m2 m6 m7 m3 m4 m5
	using "${tables}/TableI18.tex", b(%5.3f) se(%5.3f)
		title(Efficacy index -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Efficacy\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Have power\\to improve\\HC services\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Can pressure\\health worker\\(effort)\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Can pressure\\health worker\\(timely)\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Can make village\\a better place\\to live\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Influence over\\gov. about\\health services\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Influence over\\HC about\\services provided\end{tabular}")
		stats(N r2 adj_p, labels("N" "R$^{2}$" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	**********************************
	* Table Community responsibility *
	**********************************
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `commresp' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}
	
	* We create the adjusted p-value following the Benjamini-Hochberg methodology 
	
	local y = `y' - 1
	
	local ps `p_2'
	forvalues x = 3/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y' - 1
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 2/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}	
	
	* We include the adjusted p-value from the main outcomes index
	
	estimates restore m1
	estadd scalar adj_p = 0.646
	
	**************************************
	* Table Comm resp outcomes (endline) *
	**************************************

	# delimit;
	
	esttab m1 m2 m3
	using "${tables}/TableI19.tex", b(%5.3f) se(%5.3f)
		title(Community responsibility index -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Community\\responsibility\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Community resp.\\for monitoring\\HC\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Community\\members also\\responsible\end{tabular}")
		stats(N r2 adj_p, labels("N" "R$^{2}$" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	**********************
	* Table Relationship *
	**********************

	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `relship' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}
		
	local y = 5
	foreach x in `relship_hclevel' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		}
	
	* We create the adjusted p-value following the Benjamini-Hochberg methodology 
	
	local ps `p_2'
	forvalues x = 3/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y' - 1
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 2/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}	
		
	* We include the adjusted p-value from the main outcomes index
	
	estimates restore m1
	estadd scalar adj_p = 0.515
	
	*****************************************
	* Table Relationship outcomes (endline) *
	*****************************************

	# delimit;
	
	esttab m1 m2 m3 m5 m4
	using "${tables}/TableI20.tex", b(%5.3f) se(%5.3f)
		title(Relationship index -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Relationship\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Community satisfied\\with relations\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Trust\\health workers\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}HC staff\\satisfied\\with relations\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Health workers\\will listen\\to complaints\end{tabular}")
		stats(N r2 adj_p, labels("N" "R$^{2}$" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	*************************
	* Table HC transparency *
	*************************

	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `h_hctransp' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		local y = `y' + 1
		}

	* We create the adjusted p-value following the Benjamini-Hochberg methodology 
	
	local y = `y' - 1
	
	local ps `p_2'
	forvalues x = 3/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y' - 1
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 2/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}	
		
	* We include the adjusted p-value from the main outcomes index
	
	estimates restore m1
	estadd scalar adj_p = 0.930
		
	*****************************************
	* Table Transparency outcomes (endline) *
	*****************************************

	# delimit;
	
	esttab m1 m2 m3 m4 m5 m6
	using "${tables}/TableI21.tex", b(%5.3f) se(%5.3f)
		title(HC transparency index -- Subcomponents)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}HC\\transparency\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Poster with\\opening times\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Duty roster\\displayed\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Suggestion\\box\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Info\\on services\\provided\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Info\\on patient\\rights\end{tabular}")
		stats(N r2 adj_p, labels("N" "R$^{2}$" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	***************************************************************
	* Table G1: Intermediate outcome indices and their components *
	***************************************************************
	
	* We work on intermediate outcome
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* Citizen knowledge
	
	foreach var in b_numrights_hh b_numresp_hh {
		sum `var'
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.2fc")
		local `var'_sd = string(`r(sd)',"%9.2fc")
		}
		
	foreach var in m_services_hh {
		sum `var' if treatment == 4
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.2fc")
		local `var'_sd = string(`r(sd)',"%9.2fc")
		}
		
	* Health center staff knowledge
	
	foreach var in b_h_numrights b_h_numresp {
		sum `var' if uniquehc == 1
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.2fc")
		local `var'_sd = string(`r(sd)',"%9.2fc")
		}
	
	* Efficacy
	
	foreach var in b_power b_influence b_peoplesay_gov b_peoplesay_hc {
		sum `var'
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.2fc")
		local `var'_sd = string(`r(sd)',"%9.2fc")
		}
		
	foreach var in m_pressure_effort m_pressure_report {
		sum `var' if treatment == 4
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.2fc")
		local `var'_sd = string(`r(sd)',"%9.2fc")
		}
		
	* Community responsibility
	
	foreach var in b_responsible b_commembers_resp {
		sum `var'
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.2fc")
		local `var'_sd = string(`r(sd)',"%9.2fc")
		}
		
	
	* Relationship between HH and HC
	
	foreach var in b_sat_rel b_trust_hw b_complain {
		sum `var'
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.2fc")
		local `var'_sd = string(`r(sd)',"%9.2fc")
		}
	
	foreach var in b_h_satisfiedrel {
		sum `var' if uniquehc == 1
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.2fc")
		local `var'_sd = string(`r(sd)',"%9.2fc")
		}
		
	* HC Transparency
	
	foreach var in b_h_opening_posters b_h_dutyroster b_h_sugbox b_h_infoservice b_h_infoprights {
		sum `var' if uniquehc == 1
		local mean_percent = `r(mean)' * 100
		local `var'_m = string(`mean_percent',"%9.2fc")
		local `var'_sd = string(`r(sd)',"%9.2fc")
		}
		
	* Generating the table
	
	texdoc init "${tables}/TableG1.tex", replace force
	tex \begin{table}[]
	tex \footnotesize
	tex \begin{center}
	tex \begin{tabular}{ll}
	tex \hline
    tex                                                                                                                                                                                                                                                                 & \textbf{Mean}  \\ \hline
	tex \multicolumn{2}{l}{\textit{\textbf{Citizen knowledge}}}                                                                                                                                                                                                                                   \\ \hline
	tex Share of patients' rights that household head is able to name correctly                                                                                                                                                                                          & `b_numrights_hh_m'\%         \\ 
	tex Share of patients' responsibilities that household head is able to name correctly                                                                                                                                                                                & `b_numresp_hh_m'\%           \\ 
	tex \begin{tabular}[c]{@{}l@{}}Share of services offered at health center that household head is able to name correctly\end{tabular}                                                                                                                            & `m_services_hh_m'\%          \\ \hline
	tex \multicolumn{2}{l}{\textit{\textbf{Health center staff knowledge}}}                                                                                                                                                                                                                       \\ \hline
	tex Share of patients' rights that health center staff is able to name correctly                                                                                                                                                                                                   & `b_h_numrights_m'\%          \\ 
	tex Share of patients’ responsibilities that health center staff is able to name correctly                                                                                                                                                                                      &  `b_h_numresp_m'\%           \\ \hline
	tex \multicolumn{2}{l}{\textit{\textbf{Efficacy}}}   \\ \hline
	tex \begin{tabular}[c]{@{}l@{}}Whether household head thinks she has ``a lot"/``some" power to improve quality of health care at local HC\end{tabular}                                                                                                 & `b_power_m'\%          \\ 
	tex \begin{tabular}[c]{@{}l@{}}Whether household head thinks she would be able to pressure a health worker to exert better effort\end{tabular}                                                                                                & `m_pressure_effort_m'\%  \\ 
	tex \begin{tabular}[c]{@{}l@{}}Whether household head thinks she would be able to pressure a health worker to report to work on time $\diamond$ \end{tabular}                                                                           & `m_pressure_report_m'\%    \\ 
	tex	\begin{tabular}[c]{@{}l@{}}Whether household head thinks she has ``a lot" or ``some" influence in making village a better place to live $\diamond$ \end{tabular}                                                                                                           & `b_influence_m'\%        \\ 
	tex \begin{tabular}[c]{@{}l@{}}Whether household head agrees that ``People like you have a say about how the government provides\\health care to your community"\end{tabular}                                                                                         &  `b_peoplesay_gov_m'\%     \\ 
	tex \begin{tabular}[c]{@{}l@{}}Whether household head agrees that ``People like you have a say about how health facilities provide\\health care to your community"\end{tabular}                                                                                       &  `b_peoplesay_hc_m'\%        \\ \hline
	tex \multicolumn{2}{l}{\textit{\textbf{Community responsibility}}}                                                                                                                                                                                                                            \\ \hline
	tex \begin{tabular}[c]{@{}l@{}}Whether household head thinks she is responsible for making sure health workers come to work and provide\\high quality health services\end{tabular}                                                                               &  `b_responsible_m'\%    \\ 
	tex \begin{tabular}[c]{@{}l@{}}Whether household head thinks community members are responsible for making sure health workers come\\to work and provide high quality health services\end{tabular}                                                                     &  `b_commembers_resp_m'\%    \\ \hline
	tex \multicolumn{2}{l}{\textit{\textbf{Relationship between health care workers and the community}}}                                                                                                                                                                                                            \\ \hline
	tex \begin{tabular}[c]{@{}l@{}}Whether household members report being ``satisfied"/``very satisfied" with their relationship with health center staff\end{tabular}                                                                                                             &  `b_sat_rel_m'\%    \\ 
	tex Whether household members say they trust the workers at the health center                                                                                                                                                                                                         &  `b_trust_hw_m'\%     \\ 
	tex \begin{tabular}[c]{@{}l@{}}Whether health center staff report being ``satisfied"/``very satisfied" with their relationship with the community\end{tabular}                                                                                                                     &  `b_h_satisfiedrel_m'\%   \\
	tex \begin{tabular}[c]{@{}l@{}}Whether household members did not say that the health center staff would ``refuse to see me" or ``behave\\ hostilely toward me" if they had a complaint about the quality of services at the health center and decided\\ to talk to the facility staff\end{tabular} &  `b_complain_m'\%         \\ \hline
	tex \multicolumn{2}{l}{\textit{\textbf{Health center transparency}}}                                                                                                                                                                                                                                            \\ \hline
	tex \begin{tabular}[c]{@{}l@{}}Whether a poster showing health center's opening/closing hours was visible during unannounced visit to the HC\end{tabular}                                                                                                               &  `b_h_opening_posters_m'\%     \\ 
	tex Whether a staff duty roster was displayed publicly during unannounced visit                                                                                                                                                                              &  `b_h_dutyroster_m'\%          \\ 
	tex Whether a suggestion box was present during unannounced visit                                                                                                                                                                                          &  `b_h_sugbox_m'\%              \\ 
	tex \begin{tabular}[c]{@{}l@{}}Whether information was posted listing services provided at the health center during unannounced visit\end{tabular}                                                                                                                    &  `b_h_infoservice_m'\%         \\ 
	tex \begin{tabular}[c]{@{}l@{}}Whether information was posted about patients' rights and responsibilities during the announced visit\end{tabular}                                                                                                              &  `b_h_infoprights_m'\%         \\ \hline
	tex \end{tabular}
	tex \end{center}
	tex \end{table}
	texdoc close
	
	*******************************************
	* Table G3: Balance Across Treatment Arms *
	*******************************************
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	****************************************
	* A. Characteristics of catchment area *
	****************************************
	
	* We calculate the average distance to HC, variable b_distance_hc
	
	* The distance is already calculated
	
	local variable `variable' b_distance_hc
	
	* We calculate the average household wealth in CA , variable b_avg_assetindex
	
	byso hc_id: egen b_avg_assetindex = mean(b_assetindex)
	
	local variable `variable' b_avg_assetindex
	
	* We calculate the log of pop density following discussion with PIs, variable b_h_popdensity
	
	replace b_h_popdensity = log(b_h_popdensity)
	
	local variable `variable' b_h_popdensity
	
	* We calculate the level of education of the household head, variable educyr
	
	byso hc_id : egen b_educyr = mean(educyr)
	
	local variable `variable' b_educyr
	
	* We calculate the number of visit of the VHTs to household, variable b_avg_vhtvisit
	
	recode b_vht_visited_hh (2 = 0)
	
	byso hc_id : egen b_avg_vhtvisit = mean(b_vht_visited_hh)
	
	local variable `variable' b_avg_vhtvisit
	
	* We calculate the number of households declaring a NGO in the village, variable b_ngo_hc
	
	byso hc_id : egen b_avg_ngo = mean(b_ngo_hc)
	
	local variable `variable' b_avg_ngo
	
	
	* We keep the right variable
	
	preserve
	
	keep hc_id treatment treatfull treatinter treatinfo uniquehc `variable'
	
	foreach var of local variable {
	
	* Treatment group
	
	qui sum `var' if treatment == 1 & uniquehc == 1
	
	local mean_t_`var' = string(`r(mean)',"%9.2fc")
	
	* Info group
	
	qui sum `var' if treatment == 2 & uniquehc == 1
	
	local mean_inf_`var' = string(`r(mean)',"%9.2fc")
		
	* Inter group
	
	qui sum `var' if treatment == 3 & uniquehc == 1
	
	local mean_int_`var' = string(`r(mean)',"%9.2fc")
		
	* Control group
	
	qui sum `var' if treatment == 4 & uniquehc == 1
	
	local mean_c_`var' = string(`r(mean)',"%9.2fc")
	
	* Difference Treatment - Control
	
	ttest `var' if uniquehc == 1, by(treatfull)
	
	local m_diff_tc_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_tc_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_tc_`var''/`r(se)')))
	
	local p_diff_tc_`var' = string(`p_diff_tc_`var'',"%9.2fc")
	
	* Difference Info - no Info
	
	ttest `var' if uniquehc == 1, by(treatinfo)
	
	local m_diff_info_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_info_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_info_`var''/`r(se)')))
	
	local p_diff_info_`var' = string(`p_diff_info_`var'',"%9.2fc")
	
	* Difference Inter - no Inter
	
	ttest `var' if uniquehc == 1, by(treatinter)
	
	local m_diff_inter_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_inter_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_inter_`var''/`r(se)')))
	
	local p_diff_inter_`var' = string(`p_diff_inter_`var'',"%9.2fc")
	
	}
	
	restore
	
	****************************
	* B. Characteristics of HC *
	****************************

	* We calculate the % of HC providing delivery services,variable b_h_del
	
	* The variable is already calculated
	
	local variable b_h_del
	
	* We calculate the % of HC having staff houses
	
	* The variable is already calculated
	
	local variable `variable' b_h_staff_houses
	
	* We calculate the number of trained staff
	
	* The variable is already calculated
	
	local variable `variable' b_h_trainedstaff
	
	* We calculate the percentage of HC having piped water
	
	gen b_h_pipedwater = (b_h_source_water == 2)
	
	local variable `variable' b_h_pipedwater
	
	* We calculate the percentage of HC having electricity
	
	gen b_h_elec = (inlist(b_h_source_electricity,1,2))
	
	local variable `variable' b_h_elec
	
	* We calculate the distance to the nearest other type of HF
	
	* The variable is already calculated
	
	local variable `variable' b_h_mindist_hc
	
	* We keep the right variable
	
	preserve
	
	keep hc_id treatment treatfull treatinter treatinfo uniquehc `variable'
	
	foreach var of local variable {
	
	* Treatment group
	
	qui sum `var' if treatment == 1 & uniquehc == 1
	
	local mean_t_`var' = string(`r(mean)',"%9.2fc")
	
	* Info group
	
	qui sum `var' if treatment == 2 & uniquehc == 1
	
	local mean_inf_`var' = string(`r(mean)',"%9.2fc")
		
	* Inter group
	
	qui sum `var' if treatment == 3 & uniquehc == 1
	
	local mean_int_`var' = string(`r(mean)',"%9.2fc")
		
	* Control group
	
	qui sum `var' if treatment == 4 & uniquehc == 1
	
	local mean_c_`var' = string(`r(mean)',"%9.2fc")
	
	* Difference Treatment - Control
	
	ttest `var' if uniquehc == 1, by(treatfull)
	
	local m_diff_tc_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_tc_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_tc_`var''/`r(se)')))
	
	local p_diff_tc_`var' = string(`p_diff_tc_`var'',"%9.2fc")
	
	* Difference Info - no Info
	
	ttest `var' if uniquehc == 1, by(treatinfo)
	
	local m_diff_info_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_info_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_info_`var''/`r(se)')))
	
	local p_diff_info_`var' = string(`p_diff_info_`var'',"%9.2fc")
	
	* Difference Inter - no Inter
	
	ttest `var' if uniquehc == 1, by(treatinter)
	
	local m_diff_inter_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_inter_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_inter_`var''/`r(se)')))
	
	local p_diff_inter_`var' = string(`p_diff_inter_`var'',"%9.2fc")
	
	}
	
	restore
	
	*********************************************
	* C. Baseline levels of key outcome indices *
	*********************************************
	
	* We need to compute the different rate unstandardized
	
	* Community Monitoring
	
	egen b_commtg=rowmean(b_lc1_meetings b_lc1_meetings_hc b_find_report b_find_effort)		
	
	* Citizen pressure
	
	egen b_ctzpressure=rowmean(b_h_wrong b_h_pressure b_h_hw_report)
	
	* Utilization rate
	
	egen b_urate=rowmean(b_immunization b_visit_hf b_hf_otherpract)
	
	* Treatment quality
	
	egen b_treatqual=rowmean(b_use_equip b_tot_wait b_trained b_exam_privacy b_taketest b_diagnosis_explained b_h_percentstaff_sv b_h_cleanliness b_h_meanstock)
	
	* Patient satisfaction
	
	egen b_patsat=rowmean(b_qualitycare b_politestaff b_interest_health b_stafflistening b_freeexpress b_yearb_avail)
	
	* Health outcomes (household level)
	
	egen b_healthout=rowmean(b_weight_18m b_weight_36m b_muac_18m b_muac_36m)		
	
	* Mortality rate
	
	gen b_mortrate= b_mortrate_05 * 1000
	
	* We local variable
	
	local variable b_commtg b_ctzpressure b_urate b_treatqual b_patsat b_healthout b_mortrate
	
	local variable_mean
	
	foreach var of local variable{
		
	* We compute the mean at HC level
	
	byso hc_id : egen `var'_mean = mean(`var')
	
	local variable_mean `variable_mean' `var'_mean
	
	}

	* We keep the right variable
	
	preserve
	
	keep hc_id treatment treatfull treatinter treatinfo uniquehc `variable_mean'
	
	foreach var of local variable_mean {
	
	* Treatment group
	
	qui sum `var' if treatment == 1 & uniquehc == 1
	
	local mean_t_`var' = string(`r(mean)',"%9.2fc")
	
	* Info group
	
	qui sum `var' if treatment == 2 & uniquehc == 1
	
	local mean_inf_`var' = string(`r(mean)',"%9.2fc")
		
	* Inter group
	
	qui sum `var' if treatment == 3 & uniquehc == 1
	
	local mean_int_`var' = string(`r(mean)',"%9.2fc")
		
	* Control group
	
	qui sum `var' if treatment == 4 & uniquehc == 1
	
	local mean_c_`var' = string(`r(mean)',"%9.2fc")
	
	* Difference Treatment - Control
	
	ttest `var' if uniquehc == 1, by(treatfull)
	
	local m_diff_tc_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_tc_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_tc_`var''/`r(se)')))
	
	local p_diff_tc_`var' = string(`p_diff_tc_`var'',"%9.2fc")
	
	* Difference Info - no Info
	
	ttest `var' if uniquehc == 1, by(treatinfo)
	
	local m_diff_info_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_info_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_info_`var''/`r(se)')))
	
	local p_diff_info_`var' = string(`p_diff_info_`var'',"%9.2fc")
	
	* Difference Inter - no Inter
	
	ttest `var' if uniquehc == 1, by(treatinter)
	
	local m_diff_inter_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_inter_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_inter_`var''/`r(se)')))
	
	local p_diff_inter_`var' = string(`p_diff_inter_`var'',"%9.2fc")
	
	}
	
	restore
	
	* We calculate the child health outcome at child level. The reader should make sure he/she ran the do-file 8.1.
	
	preserve
	
	use "${usedata}/healthoutcome_endline_ind.dta", clear
	
	byso hc_id : egen b_healthoutcome_m = mean(b_healthoutcome)
	
	keep hc_id  b_healthoutcome_m
	
	duplicates drop
	
	tempfile individual_ho
	sa "`individual_ho'"
	
	restore
	
	preserve
	
	merge m:1 hc_id using "`individual_ho'", nogen
	
	* Health outcomes (child level)
	
	foreach var in b_healthoutcome_m {
	
	* Treatment group
	
	qui sum `var' if treatment == 1 & uniquehc == 1
	
	local mean_t_`var' = string(`r(mean)',"%9.2fc")
	
	* Info group
	
	qui sum `var' if treatment == 2 & uniquehc == 1
	
	local mean_inf_`var' = string(`r(mean)',"%9.2fc")
		
	* Inter group
	
	qui sum `var' if treatment == 3 & uniquehc == 1
	
	local mean_int_`var' = string(`r(mean)',"%9.2fc")
		
	* Control group
	
	qui sum `var' if treatment == 4 & uniquehc == 1
	
	local mean_c_`var' = string(`r(mean)',"%9.2fc")
	
	* Difference Treatment - Control
	
	ttest `var' if uniquehc == 1, by(treatfull)
	
	local m_diff_tc_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_tc_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_tc_`var''/`r(se)')))
	
	local p_diff_tc_`var' = string(`p_diff_tc_`var'',"%9.2fc")
	
	* Difference Info - no Info
	
	ttest `var' if uniquehc == 1, by(treatinfo)
	
	local m_diff_info_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_info_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_info_`var''/`r(se)')))
	
	local p_diff_info_`var' = string(`p_diff_info_`var'',"%9.2fc")
	
	* Difference Inter - no Inter
	
	ttest `var' if uniquehc == 1, by(treatinter)
	
	local m_diff_inter_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_inter_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_inter_`var''/`r(se)')))
	
	local p_diff_inter_`var' = string(`p_diff_inter_`var'',"%9.2fc")
	
	}
	
	restore
	
	******************************************************
	* D. Baseline levels of intermediate outcome indices *
	******************************************************
	
	* We need to compute the different rate unstandardized
	
	* Citizen knowledge
	
	egen b_ctzknow=rowmean(b_numrights_hh b_numresp_hh b_services_hh)		
		
	* Healthcare provider knowledge
	
	egen b_h_hcpknow=rowmean(b_h_numrights b_h_numresp)	
	
	* Efficacy
	
	egen b_eff=rowmean(b_power b_pressure_effort b_pressure_report b_influence b_peoplesay_gov b_peoplesay_hc)
	
	* Community Responsibility
	
	egen b_commresp=rowmean(b_responsible b_commembers_resp)	
	
	* Relation HH/HC
	
	egen b_relhhhc=rowmean(b_sat_rel b_trust_hw b_h_satisfiedrel b_complain)
	
	* HC Transparency
	
	egen b_h_hctrans=rowmean(b_h_opening_posters b_h_dutyroster b_h_sugbox b_h_infoservice b_h_infoprights)	
	
	local variable b_ctzknow b_h_hcpknow b_eff b_commresp b_relhhhc b_h_hctrans
	
	local variable_mean
	
	foreach var of local variable{
		
	* We compute the mean at HC level
	
	byso hc_id : egen `var'_mean = mean(`var')
	
	local variable_mean `variable_mean' `var'_mean
	
	}
	
	* We keep the right variable
	
	preserve
	
	keep hc_id treatment treatfull treatinter treatinfo uniquehc `variable_mean'
	
	foreach var of local variable_mean {
	
	* Treatment group
	
	qui sum `var' if treatment == 1 & uniquehc == 1
	
	local mean_t_`var' = string(`r(mean)',"%9.2fc")
	
	* Info group
	
	qui sum `var' if treatment == 2 & uniquehc == 1
	
	local mean_inf_`var' = string(`r(mean)',"%9.2fc")
		
	* Inter group
	
	qui sum `var' if treatment == 3 & uniquehc == 1
	
	local mean_int_`var' = string(`r(mean)',"%9.2fc")
		
	* Control group
	
	qui sum `var' if treatment == 4 & uniquehc == 1
	
	local mean_c_`var' = string(`r(mean)',"%9.2fc")
	
	* Difference Treatment - Control
	
	ttest `var' if uniquehc == 1, by(treatfull)
	
	local m_diff_tc_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_tc_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_tc_`var''/`r(se)')))
	
	local p_diff_tc_`var' = string(`p_diff_tc_`var'',"%9.2fc")
	
	* Difference Info - no Info
	
	ttest `var' if uniquehc == 1, by(treatinfo)
	
	local m_diff_info_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_info_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_info_`var''/`r(se)')))
	
	local p_diff_info_`var' = string(`p_diff_info_`var'',"%9.2fc")
	
	* Difference Inter - no Inter
	
	ttest `var' if uniquehc == 1, by(treatinter)
	
	local m_diff_inter_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_inter_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_inter_`var''/`r(se)')))
	
	local p_diff_inter_`var' = string(`p_diff_inter_`var'',"%9.2fc")
	
	}
	
	restore
	
	count if uniquehc == 1 & treatment == 1
	local n_t `r(N)'
	
	count if uniquehc == 1 & treatment == 2
	local n_inf `r(N)'
	
	count if uniquehc == 1 & treatment == 3
	local n_int `r(N)'
	
	count if uniquehc == 1 & treatment == 4
	local n_c `r(N)'
	
	**********************
	* Creating the table *
	**********************
	
	texdoc init "${tables}/TableG3.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \scriptsize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Balance Across Treatment Arms}
	tex \begin{tabular}{lccccccccc}
	tex \toprule
    tex                &\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\multicolumn{1}{c}{(3)}&\multicolumn{1}{c}{(4)}&\multicolumn{1}{c}{(5)}&\multicolumn{1}{c}{(6)}&\multicolumn{1}{c}{(7)}\\
    tex               &\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Full\\treatment\end{tabular}}&\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Information\\only\end{tabular}}&\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Interface\\only\end{tabular}}&\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Control\end{tabular}}&\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}P-value difference \\ (1) - (4)\end{tabular}}&\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}P-value difference \\ (1) \& (2) - (3) \& (4)\end{tabular}}&\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}P-value difference \\ (1) \& (3) - (2) \& (4)\end{tabular}}\\
	tex \midrule
	tex \textit{A. Characteristics of catchment area} & & & & & & & & \\
	tex \midrule
	tex Avg. distance of households to HC      &  `mean_t_b_distance_hc' & `mean_inf_b_distance_hc'   & `mean_int_b_distance_hc' &  `mean_c_b_distance_hc'   &  `p_diff_tc_b_distance_hc' & `p_diff_info_b_distance_hc'   &  `p_diff_inter_b_distance_hc'   \\
    tex Avg. household wealth in catchment area      &  `mean_t_b_avg_assetindex' & `mean_inf_b_avg_assetindex'   & `mean_int_b_avg_assetindex' &  `mean_c_b_avg_assetindex'   &  `p_diff_tc_b_avg_assetindex' & `p_diff_info_b_avg_assetindex'   &  `p_diff_inter_b_avg_assetindex'   \\
	tex Log pop. density in 3km radius around HC     &  `mean_t_b_h_popdensity' & `mean_inf_b_h_popdensity'   & `mean_int_b_h_popdensity' &  `mean_c_b_h_popdensity'   &  `p_diff_tc_b_h_popdensity' & `p_diff_info_b_h_popdensity'   &  `p_diff_inter_b_h_popdensity'   \\
	tex Avg. level of education of household head     &  `mean_t_b_educyr' & `mean_inf_b_educyr'   & `mean_int_b_educyr' &  `mean_c_b_educyr'   &  `p_diff_tc_b_educyr' & `p_diff_info_b_educyr'   &  `p_diff_inter_b_educyr'   \\
	tex Share of households that received a VHT visit in the last 12 months    &  `mean_t_b_avg_vhtvisit' & `mean_inf_b_avg_vhtvisit'   & `mean_int_b_avg_vhtvisit' &  `mean_c_b_avg_vhtvisit'   &  `p_diff_tc_b_avg_vhtvisit' & `p_diff_info_b_avg_vhtvisit'   &  `p_diff_inter_b_avg_vhtvisit'   \\
	tex Share of households that declared NGOs activity in their village &  `mean_t_b_avg_ngo' & `mean_inf_b_avg_ngo'   & `mean_int_b_avg_ngo' &  `mean_c_b_avg_ngo'   &  `p_diff_tc_b_avg_ngo' & `p_diff_info_b_avg_ngo'   &  `p_diff_inter_b_avg_ngo'   \\
	tex \midrule
	tex \textit{B. Characteristics of HC} & & & & & & & & \\
	tex \midrule
	tex Share providing delivery services      &  `mean_t_b_h_del' & `mean_inf_b_h_del'   & `mean_int_b_h_del' &  `mean_c_b_h_del'   &  `p_diff_tc_b_h_del' & `p_diff_info_b_h_del'   &  `p_diff_inter_b_h_del'   \\
    tex Share having staff houses      &  `mean_t_b_h_staff_houses' & `mean_inf_b_h_staff_houses'   & `mean_int_b_h_staff_houses' &  `mean_c_b_h_staff_houses'   &  `p_diff_tc_b_h_staff_houses' & `p_diff_info_b_h_staff_houses'   &  `p_diff_inter_b_h_staff_houses'   \\
    tex \# of trained medical staff      &  `mean_t_b_h_trainedstaff' & `mean_inf_b_h_trainedstaff'   & `mean_int_b_h_trainedstaff' &  `mean_c_b_h_trainedstaff'   &  `p_diff_tc_b_h_trainedstaff' & `p_diff_info_b_h_trainedstaff'   &  `p_diff_inter_b_h_trainedstaff'   \\
    tex Share having piped water      &  `mean_t_b_h_pipedwater' & `mean_inf_b_h_pipedwater'   & `mean_int_b_h_pipedwater' &  `mean_c_b_h_pipedwater'   &  `p_diff_tc_b_h_pipedwater' & `p_diff_info_b_h_pipedwater'   &  `p_diff_inter_b_h_pipedwater'   \\
    tex Share having electricity (grid or solar)      &  `mean_t_b_h_elec' & `mean_inf_b_h_elec'   & `mean_int_b_h_elec' &  `mean_c_b_h_elec'   &  `p_diff_tc_b_h_elec' & `p_diff_info_b_h_elec'   &  `p_diff_inter_b_h_elec'   \\
	tex Avg. distance to nearest other government HC in district     &  `mean_t_b_h_mindist_hc' & `mean_inf_b_h_mindist_hc'   & `mean_int_b_h_mindist_hc' &  `mean_c_b_h_mindist_hc'   &  `p_diff_tc_b_h_mindist_hc' & `p_diff_info_b_h_mindist_hc'   &  `p_diff_inter_b_h_mindist_hc'   \\
    tex \midrule
	tex \textit{C. Baseline levels of key outcome indices} & & & & & & & & \\
	tex \midrule
	tex Community monitoring      &  `mean_t_b_commtg_mean' & `mean_inf_b_commtg_mean'   & `mean_int_b_commtg_mean' &  `mean_c_b_commtg_mean'   &  `p_diff_tc_b_commtg_mean' & `p_diff_info_b_commtg_mean'   &  `p_diff_inter_b_commtg_mean'   \\
	tex Perceived citizen pressure      &  `mean_t_b_ctzpressure_mean' & `mean_inf_b_ctzpressure_mean'   & `mean_int_b_ctzpressure_mean' &  `mean_c_b_ctzpressure_mean'   &  `p_diff_tc_b_ctzpressure_mean' & `p_diff_info_b_ctzpressure_mean'   &  `p_diff_inter_b_ctzpressure_mean'   \\
	tex Utilization     &  `mean_t_b_urate_mean' & `mean_inf_b_urate_mean'   & `mean_int_b_urate_mean' &  `mean_c_b_urate_mean'   &  `p_diff_tc_b_urate_mean' & `p_diff_info_b_urate_mean'   &  `p_diff_inter_b_urate_mean'   \\
    tex Treatment quality      &  `mean_t_b_treatqual_mean' & `mean_inf_b_treatqual_mean'   & `mean_int_b_treatqual_mean' &  `mean_c_b_treatqual_mean'   &  `p_diff_tc_b_treatqual_mean' & `p_diff_info_b_treatqual_mean'   &  `p_diff_inter_b_treatqual_mean'   \\
    tex Patient satisfaction      &  `mean_t_b_patsat_mean' & `mean_inf_b_patsat_mean'   & `mean_int_b_patsat_mean' &  `mean_c_b_patsat_mean'   &  `p_diff_tc_b_patsat_mean' & `p_diff_info_b_patsat_mean'   &  `p_diff_inter_b_patsat_mean'   \\
    tex Health outcomes (HH level)     &  `mean_t_b_healthout_mean' & `mean_inf_b_healthout_mean'   & `mean_int_b_healthout_mean' &  `mean_c_b_healthout_mean'   &  `p_diff_tc_b_healthout_mean' & `p_diff_info_b_healthout_mean'   &  `p_diff_inter_b_healthout_mean'   \\
    tex Health outcomes (Child level)    &  `mean_t_b_healthoutcome_m' & `mean_inf_b_healthoutcome_m'   & `mean_int_b_healthoutcome_m' &  `mean_c_b_healthoutcome_m'   &  `p_diff_tc_b_healthoutcome_m' & `p_diff_info_b_healthoutcome_m'   &  `p_diff_inter_b_healthoutcome_m'   \\
	tex Child Mortality (deaths per 1,000 live births)      &  `mean_t_b_mortrate_mean' & `mean_inf_b_mortrate_mean'   & `mean_int_b_mortrate_mean' &  `mean_c_b_mortrate_mean'   &  `p_diff_tc_b_mortrate_mean' & `p_diff_info_b_mortrate_mean'   &  `p_diff_inter_b_mortrate_mean'   \\
    tex \midrule
	tex \textit{D. Baseline levels of intermediate outcome indices} & & & & & & & & \\
	tex \midrule
	tex Citizen knowledge      &  `mean_t_b_ctzknow_mean' & `mean_inf_b_ctzknow_mean'   & `mean_int_b_ctzknow_mean' &  `mean_c_b_ctzknow_mean'   &  `p_diff_tc_b_ctzknow_mean' & `p_diff_info_b_ctzknow_mean'   &  `p_diff_inter_b_ctzknow_mean'   \\
	tex Health worker knowledge      &  `mean_t_b_h_hcpknow_mean' & `mean_inf_b_h_hcpknow_mean'   & `mean_int_b_h_hcpknow_mean' &  `mean_c_b_h_hcpknow_mean'   &  `p_diff_tc_b_h_hcpknow_mean' & `p_diff_info_b_h_hcpknow_mean'   &  `p_diff_inter_b_h_hcpknow_mean'   \\
	tex Efficacy      &  `mean_t_b_eff_mean' & `mean_inf_b_eff_mean'   & `mean_int_b_eff_mean' &  `mean_c_b_eff_mean'   &  `p_diff_tc_b_eff_mean' & `p_diff_info_b_eff_mean'   &  `p_diff_inter_b_eff_mean'   \\
	tex Community responsibility      &  `mean_t_b_commresp_mean' & `mean_inf_b_commresp_mean'   & `mean_int_b_commresp_mean' &  `mean_c_b_commresp_mean'   &  `p_diff_tc_b_commresp_mean' & `p_diff_info_b_commresp_mean'   &  `p_diff_inter_b_commresp_mean'   \\
	tex Relationship between health workers and community    &  `mean_t_b_relhhhc_mean' & `mean_inf_b_relhhhc_mean'   & `mean_int_b_relhhhc_mean' &  `mean_c_b_relhhhc_mean'   &  `p_diff_tc_b_relhhhc_mean' & `p_diff_info_b_relhhhc_mean'   &  `p_diff_inter_b_relhhhc_mean'   \\
	tex Health center transparency      &  `mean_t_b_h_hctrans_mean' & `mean_inf_b_h_hctrans_mean'   & `mean_int_b_h_hctrans_mean' &  `mean_c_b_h_hctrans_mean'   &  `p_diff_tc_b_h_hctrans_mean' & `p_diff_info_b_h_hctrans_mean'   &  `p_diff_inter_b_h_hctrans_mean'   \\
	tex \midrule
	tex N & `n_t' & `n_inf' & `n_int' & `n_c' & & & \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	
	*********************************************
	* Table G1: Attrition Across Treatment Arms *
	*********************************************
	
	* We load the dataset. This is the light version
	
	use "${usedata}/chp_el_attrition_dataset.dta", clear
	
	* We prepare the data
	
	replace m_consent = 0 if m_consent != 1
	replace e_consent = 0 if e_consent != 1
	
	byso hc_id: egen temp = mean(m_consent)
	drop m_consent
	ren temp m_consent
	
	byso hc_id: egen temp = mean(e_consent)
	drop e_consent
	ren temp e_consent
	
	drop hh_id
	duplicates drop
	
	gen treatfull = .
	replace treatfull = 1 if treatment == 1
	replace treatfull = 0 if treatment == 4
	
	gen treatinfo = .
	replace treatinfo = 1 if inlist(treatment,1,2)
	replace treatinfo = 0 if inlist(treatment,3,4)
	
	gen treatinter = .
	replace treatinter = 1 if inlist(treatment,1,3)
	replace treatinter = 0 if inlist(treatment,2,4)
	
	foreach var in treatfull treatinfo treatinter {
	
		ttest m_consent, by(`var')
		local m_`var' = r(p)
		local m_`var' = string(`m_`var'',"%9.2fc")
		
		ttest e_consent, by(`var')
		local e_`var' = r(p)
		local e_`var' = string(`e_`var'',"%9.2fc")
		
		}
	
	forvalues x = 1/4 {
	
		sum m_consent if treatment == `x'
		local m_consent_`x' = r(mean)
		local m_consent_`x' = string(`m_consent_`x'',"%9.3fc")
		
		sum e_consent if treatment == `x'
		local e_consent_`x' = r(mean)
		local e_consent_`x' = string(`e_consent_`x'',"%9.3fc")
		
		}
		

	texdoc init "${tables}/TableG1.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \small
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Table F1: Attrition Across Treatment Arms}
	tex \begin{tabular}{lccccccc}
	tex \toprule
	tex																				 & (1)                                                                            & \multicolumn{1}{c}{(2)}                                         & (3)                                                            & (4)     & (5)                                                                    & (6)                                                                              & (7)                                                                              \\
	tex																				 & \multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Full \\ Treatment\end{tabular}} & \begin{tabular}[c]{@{}c@{}}Information \\ Treatment\end{tabular} & \begin{tabular}[c]{@{}c@{}}Interface \\ Treatment\end{tabular} & Control & \begin{tabular}[c]{@{}c@{}}P-value Difference\\ (1) - (4)\end{tabular} & \begin{tabular}[c]{@{}c@{}}P-value Difference\\ (1)\&(2) - (3)\&(4)\end{tabular} & \begin{tabular}[c]{@{}c@{}}P-value Difference\\ (1)\&(3) - (2)\&(4)\end{tabular} \\
	tex \begin{tabular}[c]{@{}l@{}}Reinterview rate, \\ baseline to midline\end{tabular} &          `m_consent_1'                                                                      &    `m_consent_2'                                                              &                      `m_consent_3'                                          &    `m_consent_4'     &                        `m_treatfull'                                                &     `m_treatinfo'                                                                              &        `m_treatinter'                                                                           \\
	tex \begin{tabular}[c]{@{}l@{}}Reinterview rate, \\ baseline to endline\end{tabular} &          `e_consent_1'                                                                      &    `e_consent_2'                                                            &                        `e_consent_3'                                        &     `e_consent_4'    &                                `e_treatfull'                                        &          `e_treatinfo'                                                                         &           `e_treatinter'                                                                       
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	********************************
	* Table G2: Spillover analysis *
	********************************
	
	* We load the dataset. This is the light version
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* We merge the distance to health centre to control HC
	
	drop if treatment != 4
	
	merge m:1 hc_id using "${usedata}/Distance to treated HC.dta", nogen
	
	* We compute mean value at HC to drop hh level
	
	local indices commtg_z h_ctzpressure_z urate_z treatqual_z patsat_z healthout_z mortrate_05
	
	foreach var of local indices {
		foreach x in b_ bm_ m_ e_ { 
			byso hc_id : egen `x'mean_`var' = mean (`x'`var')
			}
		foreach x in m_ { 	
			gen `x'diff_`var' = `x'mean_`var' -  bm_mean_`var'
			}
		foreach x in e_ { 	
			gen `x'diff_`var' = `x'mean_`var' -  b_mean_`var'
			}
		}
		
	* We drop HH level
	
	duplicates drop hc_id, force
	
	* We need to reshape to calculate the distribution
	
	foreach x in b_ m_ e_ { 
		local `x'indices
		foreach var of local indices {
			local `x'indices ``x'indices' `x'mean_`var'
			}
		}
		
	foreach x in m_ e_ { 
		local `x'indices_d
		foreach var of local indices {
			local `x'indices_d ``x'indices_d' `x'diff_`var'
			}
		}

	keep hc_id `b_indices' `m_indices' `e_indices' `m_indices_d' `e_indices_d' dist_hc*

	reshape long dist_hc, i(hc_id) j(pos)
	
	* We keep the minimum value
	
	byso hc_id : egen min_dist = min(dist_hc)

	duplicates drop hc_id, force
	
	drop dist_hc pos
	
	* We calculate the 67th percentile
	
	centile min_dist, centile(67)
	
	gen pct67 = `r(c_1)'
	
	gen close_hc = (min_dist<=pct67)
	
	count if close_hc == 1
	local n_close `r(N)'
	
	count if close_hc == 0
	local n_far `r(N)'
	
	* We have the variable we were looking for
	
	foreach indices in b_indices m_indices e_indices {
		foreach var of local `indices' { 
			sum `var' if close == 1
			local cl_`var' `r(mean)'
			local cl_`var' = string(`cl_`var'',"%9.3fc")
			sum `var' if close == 0
			local fr_`var' `r(mean)'
			local fr_`var' = string(`fr_`var'',"%9.3fc")
			}
		}
	
	foreach indices in b_indices m_indices e_indices {
		foreach var of local `indices' {
			ttest `var', by(close)
			local m_diff_`var' = `r(mu_1)' - `r(mu_2)'
			local p_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_`var''/`r(se)')))
			local p_`var' = string(`p_`var'',"%9.3fc")
			}
		}
		
	* We calculate the mean and p-values of the difference
	
	foreach indices in m_indices_d e_indices_d {
		foreach var of local `indices' { 
			sum `var' if close == 1
			local cl_`var' `r(mean)'
			local cl_`var' = string(`cl_`var'',"%9.3fc")
			sum `var' if close == 0
			local fr_`var' `r(mean)'
			local fr_`var' = string(`fr_`var'',"%9.3fc")
			}
		}
	
	foreach indices in m_indices_d e_indices_d {
		foreach var of local `indices' {
			ttest `var', by(close)
			local m_diff_`var' = `r(mu_1)' - `r(mu_2)'
			local p_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_`var''/`r(se)')))
			local p_`var' = string(`p_`var'',"%9.3fc")
			}
		}
	
	* We calculate the health outcome at the child level
	
	preserve
	
	* We load the midline dataset. The reader should make sure he/she ran the do-file 8.1 previously.
	
	use "${usedata}/healthoutcome_midline_ind.dta", clear
	
	* We merge the distance to health centre to control HC
	
	drop if treatment != 4
	
	merge m:1 hc_id using "${usedata}/Distance to treated HC.dta", nogen
	
	* We compute mean value at HC to drop individual level
	
	local indices healthoutcome_z
	
	foreach var of local indices {
		foreach x in b_ m_ { 
			byso hc_id : egen `x'mean_`var' = mean (`x'`var')
			}
		foreach x in m_ { 	
			gen `x'diff_`var' = `x'mean_`var' -  b_mean_`var'
			}
		}
		
	* We drop HH level
	
	duplicates drop hc_id, force
	
	* We need to reshape to calculate the distribution
	
	foreach x in b_ m_ { 
		local `x'indices
		foreach var of local indices {
			local `x'indices ``x'indices' `x'mean_`var'
			}
		}
		
	foreach x in m_ { 
		local `x'indices_d
		foreach var of local indices {
			local `x'indices_d ``x'indices_d' `x'diff_`var'
			}
		}

	keep hc_id `b_indices' `m_indices' `m_indices_d' dist_hc*

	reshape long dist_hc, i(hc_id) j(pos)
	
	* We keep the minimum value
	
	byso hc_id : egen min_dist = min(dist_hc)

	duplicates drop hc_id, force
	
	drop dist_hc pos
	
	* We calculate the 67th percentile
	
	centile min_dist, centile(67)
	
	gen pct67 = `r(c_1)'
	
	gen close_hc = (min_dist<=pct67)
	
	count if close_hc == 1
	local n_close `r(N)'
	
	count if close_hc == 0
	local n_far `r(N)'
	
	* We have the variable we were looking for
	
	foreach indices in b_indices m_indices {
		foreach var of local `indices' { 
			sum `var' if close == 1
			local cl_`var' `r(mean)'
			local cl_`var' = string(`cl_`var'',"%9.3fc")
			sum `var' if close == 0
			local fr_`var' `r(mean)'
			local fr_`var' = string(`fr_`var'',"%9.3fc")
			}
		}
	
	foreach indices in b_indices m_indices {
		foreach var of local `indices' {
			ttest `var', by(close)
			local m_diff_`var' = `r(mu_1)' - `r(mu_2)'
			local p_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_`var''/`r(se)')))
			local p_`var' = string(`p_`var'',"%9.3fc")
			}
		}
		
	* We calculate the mean and p-values of the difference
	
	foreach indices in m_indices_d {
		foreach var of local `indices' { 
			sum `var' if close == 1
			local cl_`var' `r(mean)'
			local cl_`var' = string(`cl_`var'',"%9.3fc")
			sum `var' if close == 0
			local fr_`var' `r(mean)'
			local fr_`var' = string(`fr_`var'',"%9.3fc")
			}
		}
	
	foreach indices in m_indices_d {
		foreach var of local `indices' {
			ttest `var', by(close)
			local m_diff_`var' = `r(mu_1)' - `r(mu_2)'
			local p_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_`var''/`r(se)')))
			local p_`var' = string(`p_`var'',"%9.3fc")
			}
		}
	
	restore
	
	preserve
	
	* We load the endline dataset. The reader should make sure he/she ran the do-file 8.1 previously.
	
	use "${usedata}/healthoutcome_endline_ind.dta", clear
	
	* We merge the distance to health centre to control HC
	
	drop if treatment != 4
	
	merge m:1 hc_id using "${usedata}/Distance to treated HC.dta", nogen
	
	* We compute mean value at HC to drop individual level
	
	local indices healthoutcome_z
	
	foreach var of local indices {
		foreach x in b_ e_ { 
			byso hc_id : egen `x'mean_`var' = mean (`x'`var')
			}
		foreach x in e_ { 	
			gen `x'diff_`var' = `x'mean_`var' -  b_mean_`var'
			}
		}
		
	* We drop HH level
	
	duplicates drop hc_id, force
	
	* We need to reshape to calculate the distribution
	
	foreach x in b_ e_ { 
		local `x'indices
		foreach var of local indices {
			local `x'indices ``x'indices' `x'mean_`var'
			}
		}
		
	foreach x in e_ { 
		local `x'indices_d
		foreach var of local indices {
			local `x'indices_d ``x'indices_d' `x'diff_`var'
			}
		}

	keep hc_id `b_indices' `e_indices' `e_indices_d' dist_hc*

	reshape long dist_hc, i(hc_id) j(pos)
	
	* We keep the minimum value
	
	byso hc_id : egen min_dist = min(dist_hc)

	duplicates drop hc_id, force
	
	drop dist_hc pos
	
	* We calculate the 67th percentile
	
	centile min_dist, centile(67)
	
	gen pct67 = `r(c_1)'
	
	gen close_hc = (min_dist<=pct67)
	
	count if close_hc == 1
	local n_close `r(N)'
	
	count if close_hc == 0
	local n_far `r(N)'
	
	* We have the variable we were looking for
	
	foreach indices in b_indices e_indices {
		foreach var of local `indices' { 
			sum `var' if close == 1
			local cl_`var' `r(mean)'
			local cl_`var' = string(`cl_`var'',"%9.3fc")
			sum `var' if close == 0
			local fr_`var' `r(mean)'
			local fr_`var' = string(`fr_`var'',"%9.3fc")
			}
		}
	
	foreach indices in b_indices e_indices {
		foreach var of local `indices' {
			ttest `var', by(close)
			local e_diff_`var' = `r(mu_1)' - `r(mu_2)'
			local p_`var' = (2 * ttail(`r(df_t)', abs(`e_diff_`var''/`r(se)')))
			local p_`var' = string(`p_`var'',"%9.3fc")
			}
		}
		
	* We calculate the mean and p-values of the difference
	
	foreach indices in e_indices_d {
		foreach var of local `indices' { 
			sum `var' if close == 1
			local cl_`var' `r(mean)'
			local cl_`var' = string(`cl_`var'',"%9.3fc")
			sum `var' if close == 0
			local fr_`var' `r(mean)'
			local fr_`var' = string(`fr_`var'',"%9.3fc")
			}
		}
	
	foreach indices in e_indices_d {
		foreach var of local `indices' {
			ttest `var', by(close)
			local e_diff_`var' = `r(mu_1)' - `r(mu_2)'
			local p_`var' = (2 * ttail(`r(df_t)', abs(`e_diff_`var''/`r(se)')))
			local p_`var' = string(`p_`var'',"%9.3fc")
			}
		}
	
	restore
	
	* Difference
	
	texdoc init "${tables}/TableG2.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \small
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Spillover analysis}
	tex \begin{tabular}{lccc}
	tex \toprule
    tex &\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Mean of close \\ control HC\end{tabular}}&\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Mean of far \\ control HC\end{tabular}} & \multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}P-value\\difference\end{tabular}} \\
	tex \midrule
	tex \textit{A. Difference Midline - Baseline levels of key outcome indices} & & & \\
	tex \midrule
	tex Citizen monitoring     &  `cl_m_diff_commtg_z' & `fr_m_diff_commtg_z' & `p_m_diff_commtg_z' \\
	tex Perceived citizen pressure     &  `cl_m_diff_h_ctzpressure_z' & `fr_m_diff_h_ctzpressure_z' & `p_m_diff_h_ctzpressure_z' \\
	tex Utilization     &  `cl_m_diff_urate_z' & `fr_m_diff_urate_z' & `p_m_diff_urate_z' \\
    tex Treatment quality      &  `cl_m_diff_treatqual_z' & `fr_m_diff_treatqual_z' & `p_m_diff_treatqual_z' \\
	tex Patient satisfaction      &  `cl_m_diff_patsat_z' & `fr_m_diff_patsat_z' & `p_m_diff_patsat_z' \\
	tex Health outcomes (HH lvl. averaged at HC lvl.)     &  `cl_m_diff_healthout_z' & `fr_m_diff_healthout_z' & `p_m_diff_healthout_z' \\
	tex Health outcomes (Child lvl. averaged at HC lvl.)     &  `cl_m_diff_healthoutcome_z' & `fr_m_diff_healthoutcome_z' & `p_m_diff_healthoutcome_z' \\
	tex Child Mortality      &  `cl_m_diff_mortrate_05' & `fr_m_diff_mortrate_05' & `p_m_diff_mortrate_05' \\
	tex \midrule
	tex \textit{B. Difference Endline - Baseline levels of key outcome indices} & & & \\
	tex \midrule
	tex Citizen monitoring     &  `cl_e_diff_commtg_z' & `fr_e_diff_commtg_z' & `p_e_diff_commtg_z' \\
	tex Perceived citizen pressure     &  `cl_e_diff_h_ctzpressure_z' & `fr_e_diff_h_ctzpressure_z' & `p_e_diff_h_ctzpressure_z' \\
	tex Utilization     &  `cl_e_diff_urate_z' & `fr_e_diff_urate_z' & `p_e_diff_urate_z' \\
    tex Treatment quality      &  `cl_e_diff_treatqual_z' & `fr_e_diff_treatqual_z' & `p_e_diff_treatqual_z' \\
	tex Patient satisfaction      &  `cl_e_diff_patsat_z' & `fr_e_diff_patsat_z' & `p_e_diff_patsat_z' \\
	tex Health outcomes (HH lvl. averaged at HC lvl.)     &  `cl_e_diff_healthout_z' & `fr_e_diff_healthout_z' & `p_e_diff_healthout_z' \\
	tex Health outcomes (Child lvl. averaged at HC lvl.)     &  `cl_e_diff_healthoutcome_z' & `fr_e_diff_healthoutcome_z' & `p_e_diff_healthoutcome_z' \\
	tex Child Mortality      &  `cl_e_diff_mortrate_05' & `fr_e_diff_mortrate_05' & `p_e_diff_mortrate_05' \\
	tex \midrule
	tex N & `n_close' & `n_far' &  \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	***************************************************************************************
	* Table I22: Subgroup effects on main outcomes – Proxies of low levels of development *
	***************************************************************************************
	
	* &
	
	**********************************************************************************
	* Table I23: Subgroup effects on main outcomes – Proxies of community engagement *
	**********************************************************************************
	
	* Running subgroup analyse by position toward child mortality
	
	* We first calculate the average U5M for the control group at endline P2P (bline is not available)
	
	use "${usedata}/u5mortality_ctrls.dta", clear
	
	* We calculate the threshold
	
	sum u5mortality if treatment == 0
	
	local threshold_low = `r(mean)' - `r(sd)'
	local threshold_high = `r(mean)' + `r(sd)'
	* We have now our local we load the P2P dataset
	
	use "${usedata}/baseline_U5M.dta", clear
	
	* We calculate the sample that corresponds to ACT Health HCs with same starting condition than P2P
	
	gen u5_p2p = (b_u5mortality >= `threshold_low' & b_u5mortality <= `threshold_high' )
	
	keep hc_id u5_*
	
	tempfile bu5m
	sa "`bu5m'"
	
	**************************
	* Household and HC level *
	**************************

	* At endline
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	**************************************************
	** Indices corresponds to the 4 main indicators **
	**************************************************
	
	ren e_h_ctzpressure_z e_h_ctzpre_z
	ren b_h_ctzpressure_z b_h_ctzpre_z
	
	ren b_h_ctzpressure_z_d b_h_ctzpre_z_d
	
	
	* We create it for endline and baseline and one only irrespective to the timeline
	
	local indices urate_z treatqual_z patsat_z commtg_z
	local indices_hc mortrate_05 h_ctzpre_z
	
	
	* We should have:
		* Endline: 14,609 obs
		* Midline: 14,459 obs
		* Baseline: 15,295 obs
		
	* We recode the variable to study backwardness
	
	foreach var in b_treatqual_z_med_d b_h_urb_area b_h_outsideoption_z_med_d b_ngo_hc b_distance_hc_z_med_d {
	
		recode `var' (0=1) (1=0)
		
		}
		
	replace treatfull_treatqual = treatfull * b_treatqual_z_med_d
	replace treatfull_outsideoption = treatfull * b_h_outsideoption_z_med_d 
	replace treatfull_urbanarea = treatfull * b_h_urb_area
	replace treatfull_ngo_hc = treatfull * b_ngo_hc
	replace treatfull_distance = treatfull * b_distance_hc_z_med_d
	
	
	**********************************************************
	** Controlvar corresponds to the main control variables **
	**********************************************************
	
	* We local control variables without the HC level components
	
	local  e_controls_noprefix b_visited_d educyr b_assetindex
		
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_hc
		
		local `x'controls_tfull
		local `x'controls_tfull_hc
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
		
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			
			}
		}
				
	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		
		local e_controls_hc `e_controls_hc' c_hc_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
		
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			
			}
		}
	
	* We regress the results
			
	* In this section, we regress the various subgroup effects over the different main outcomes
	
	* Subgroup Effects: Health Centre 2
	
	foreach x in `indices' {
		areg e_`x' treatfull treatfull_hc2 hc2 b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		eststo e_`x'_hc2
		local n_hc3_`x' = string(e(N),"%9.0fc")
		local r2_hc3_`x' = string(e(r2),"%9.3fc")

		lincom treatfull + treatfull_hc2 
		local est_hc2_`x' = r(estimate)
		local se_hc2_`x' = r(se)
		test treatfull + treatfull_hc2 = 0
		local p_hc2_`x' = r(p)
		
		local est_hc3_`x' = string(_b[treatfull],"%9.3fc")
		local se_hc3_`x' = string(_se[treatfull],"%9.3fc")
		local p_hc3_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxhc3_`x' = string(_b[treatfull_hc2],"%9.3fc")
		local se_tmxhc3_`x' = string(_se[treatfull_hc2],"%9.3fc")
		local p_tmxhc3_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_hc2]/_se[treatfull_hc2])))
		
		local est_smhc3_`x' = string(_b[hc2],"%9.3fc")
		local se_smhc3_`x' = string(_se[hc2],"%9.3fc")
		local p_smhc3_`x' = (2 * ttail(e(df_r), abs(_b[hc2]/_se[hc2])))
		
		local est_chc3_`x' = string(_b[_cons],"%9.3fc")
		local se_chc3_`x' = string(_se[_cons],"%9.3fc")
		local p_chc3_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in hc3 tmxhc3 smhc3 chc3 {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			

			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
		
		gen sign_hc2_zero_`x' = (`p_hc2_`x''>0.1)
		gen sign_hc2_p1s_`x' = (`p_hc2_`x''<=0.1 & `p_hc2_`x''>0.05 & `est_hc2_`x''>0)
		gen sign_hc2_p2s_`x' = (`p_hc2_`x''<=0.05 & `p_hc2_`x''>0.01 & `est_hc2_`x''>0)
		gen sign_hc2_p3s_`x' = (`p_hc2_`x''<=0.01 & `p_hc2_`x''>=0 & `est_hc2_`x''>0)
		gen sign_hc2_m1s_`x' = (`p_hc2_`x''<=0.1 & `p_hc2_`x''>0.05 & `est_hc2_`x''<0)
		gen sign_hc2_m2s_`x' = (`p_hc2_`x''<=0.05 & `p_hc2_`x''>0.01 & `est_hc2_`x''<0)
		gen sign_hc2_m3s_`x' = (`p_hc2_`x''<=0.01 & `p_hc2_`x''>=0 & `est_hc2_`x''<0)
		
		local p_hc2_`x' = string(`p_hc2_`x'',"%9.3fc")
		local est_hc2_`x' = string(`est_hc2_`x'',"%9.3fc")
		local se_hc2_`x' = string(`se_hc2_`x'',"%9.3fc")
		
		if sign_hc2_p1s_`x' == 1 {
				local sign_hc2_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_hc2_`x' = "`est_hc2_`x''*"
				}
				
		if sign_hc2_p2s_`x' == 1 {	
				local sign_hc2_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_hc2_`x' = "`est_hc2_`x''**"
				}
				
		if sign_hc2_p3s_`x' == 1 {	
				local sign_hc2_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_hc2_`x' = "`est_hc2_`x''***"
				}
			
		if sign_hc2_m1s_`x' == 1 {
				local sign_hc2_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_hc2_`x' = "`est_hc2_`x''*"
				}
				
		if sign_hc2_m2s_`x' == 1 {	
				local sign_hc2_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_hc2_`x' = "`est_hc2_`x''**"
				}
				
		if sign_hc2_m3s_`x' == 1 {	
				local sign_hc2_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_hc2_`x' = "`est_hc2_`x''***"
				}
			
		if sign_hc2_zero_`x' == 1 {
			local sign_hc2_`x' = "0"
			}
		
		drop sign_*

		}
		
	* Subgroup effects: Treatment Quality
	
	* We local control variables with the HC level components
	
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_hc
		
		local `x'controls_tfull
		local `x'controls_tfull_hc
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
		
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			
			}
		}
				
	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		
		local e_controls_hc `e_controls_hc' c_hc_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
		
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			
			}
		}
		
	* We regress the results
	
	foreach x in `indices' {
		areg e_`x' treatfull treatfull_treatqual b_treatqual_z_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		eststo e_`x'_treatqual
		local n_treatqual_`x' = string(e(N),"%9.0fc")
		local r2_treatqual_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_treatqual
		local est_treatqual_`x' = r(estimate)
		local se_treatqual_`x' = r(se)
		test treatfull + treatfull_treatqual = 0
		local p_treatqual_`x' = r(p)
		
		local est_btreatqual_`x' = string(_b[treatfull],"%9.3fc")
		local se_btreatqual_`x' = string(_se[treatfull],"%9.3fc")
		local p_btreatqual_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxtqual_`x' = string(_b[treatfull_treatqual],"%9.3fc")
		local se_tmxtqual_`x' = string(_se[treatfull_treatqual],"%9.3fc")
		local p_tmxtqual_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_treatqual]/_se[treatfull_treatqual])))
		
		local est_smtqual_`x' = string(_b[b_treatqual_z_med_d],"%9.3fc")
		local se_smtqual_`x' = string(_se[b_treatqual_z_med_d],"%9.3fc")
		local p_smtqual_`x' = (2 * ttail(e(df_r), abs(_b[b_treatqual_z_med_d]/_se[b_treatqual_z_med_d])))
		
		local est_ctqual_`x' = string(_b[_cons],"%9.3fc")
		local se_ctqual_`x' = string(_se[_cons],"%9.3fc")
		local p_ctqual_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in btreatqual tmxtqual smtqual ctqual {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}

		
		gen sign_treatqual_zero_`x' = (`p_treatqual_`x''>0.1)
		gen sign_treatqual_p1s_`x' = (`p_treatqual_`x''<=0.1 & `p_treatqual_`x''>0.05 & `est_treatqual_`x''>0)
		gen sign_treatqual_p2s_`x' = (`p_treatqual_`x''<=0.05 & `p_treatqual_`x''>0.01 & `est_treatqual_`x''>0)
		gen sign_treatqual_p3s_`x' = (`p_treatqual_`x''<=0.01 & `p_treatqual_`x''>=0 & `est_treatqual_`x''>0)
		gen sign_treatqual_m1s_`x' = (`p_treatqual_`x''<=0.1 & `p_treatqual_`x''>0.05 & `est_treatqual_`x''<0)
		gen sign_treatqual_m2s_`x' = (`p_treatqual_`x''<=0.05 & `p_treatqual_`x''>0.01 & `est_treatqual_`x''<0)
		gen sign_treatqual_m3s_`x' = (`p_treatqual_`x''<=0.01 & `p_treatqual_`x''>=0 & `est_treatqual_`x''<0)
		
		local p_treatqual_`x' = string(`p_treatqual_`x'',"%9.3fc")
		local est_treatqual_`x' = string(`est_treatqual_`x'',"%9.3fc")
		local se_treatqual_`x' = string(`se_treatqual_`x'',"%9.3fc")
		
		if sign_treatqual_p1s_`x' == 1 {
				local sign_treatqual_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_treatqual_`x' = "`est_treatqual_`x''*"
				}
				
		if sign_treatqual_p2s_`x' == 1 {	
				local sign_treatqual_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_treatqual_`x' = "`est_treatqual_`x''**"
				}
				
		if sign_treatqual_p3s_`x' == 1 {	
				local sign_treatqual_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_treatqual_`x' = "`est_treatqual_`x''***"
				}
			
		if sign_treatqual_m1s_`x' == 1 {
				local sign_treatqual_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_treatqual_`x' = "`est_treatqual_`x''*"
				}
				
		if sign_treatqual_m2s_`x' == 1 {	
				local sign_treatqual_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_treatqual_`x' = "`est_treatqual_`x''**"
				}
				
		if sign_treatqual_m3s_`x' == 1 {	
				local sign_treatqual_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_treatqual_`x' = "`est_treatqual_`x''***"
				}
			
		if sign_treatqual_zero_`x' == 1 {
			local sign_treatqual_`x' = "0"
			}
		
		drop sign_*
		
		}
		
	* Subgroup Effects: Outside Options
	
	* We create the vector of control without HC level components
	
	local  e_controls_noprefix b_visited_d educyr b_assetindex
		
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_hc
		
		local `x'controls_tfull
		local `x'controls_tfull_hc
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
		
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			
			}
		}
				
	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		
		local e_controls_hc `e_controls_hc' c_hc_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
		
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			
			}
		}
		
	* We regress the results
	
	foreach x in `indices' {
	
		areg e_`x' treatfull treatfull_outsideoption b_h_outsideoption_z_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		eststo e_`x'_outsideoption
		local n_outside_`x' = string(e(N),"%9.0fc")
		local r2_outside_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_outsideoption
		local est_outside_`x' = r(estimate)
		local se_outside_`x' = r(se)
		test treatfull + treatfull_outsideoption = 0
		local p_outside_`x' = r(p)
		
		local est_boutside_`x' = string(_b[treatfull],"%9.3fc")
		local se_boutside_`x' = string(_se[treatfull],"%9.3fc")
		local p_boutside_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxoutside_`x' = string(_b[treatfull_outsideoption],"%9.3fc")
		local se_tmxoutside_`x' = string(_se[treatfull_outsideoption],"%9.3fc")
		local p_tmxoutside_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_outsideoption]/_se[treatfull_outsideoption])))
		
		local est_smoutside_`x' = string(_b[b_h_outsideoption_z_med_d],"%9.3fc")
		local se_smoutside_`x' = string(_se[b_h_outsideoption_z_med_d],"%9.3fc")
		local p_smoutside_`x' = (2 * ttail(e(df_r), abs(_b[b_h_outsideoption_z_med_d]/_se[b_h_outsideoption_z_med_d])))
		
		local est_coutside_`x' = string(_b[_cons],"%9.3fc")
		local se_coutside_`x' = string(_se[_cons],"%9.3fc")
		local p_coutside_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in boutside tmxoutside smoutside coutside {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
		
		gen sign_outside_zero_`x' = (`p_outside_`x''>0.1)
		gen sign_outside_p1s_`x' = (`p_outside_`x''<=0.1 & `p_outside_`x''>0.05 & `est_outside_`x''>0)
		gen sign_outside_p2s_`x' = (`p_outside_`x''<=0.05 & `p_outside_`x''>0.01 & `est_outside_`x''>0)
		gen sign_outside_p3s_`x' = (`p_outside_`x''<=0.01 & `p_outside_`x''>=0 & `est_outside_`x''>0)
		gen sign_outside_m1s_`x' = (`p_outside_`x''<=0.1 & `p_outside_`x''>0.05 & `est_outside_`x''<0)
		gen sign_outside_m2s_`x' = (`p_outside_`x''<=0.05 & `p_outside_`x''>0.01 & `est_outside_`x''<0)
		gen sign_outside_m3s_`x' = (`p_outside_`x''<=0.01 & `p_outside_`x''>=0 & `est_outside_`x''<0)
		
		local p_outside_`x' = string(`p_outside_`x'',"%9.3fc")
		local est_outside_`x' = string(`est_outside_`x'',"%9.3fc")
		local se_outside_`x' = string(`se_outside_`x'',"%9.3fc")
		
		if sign_outside_p1s_`x' == 1 {
				local sign_outside_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_outside_`x' = "`est_outside_`x''*"
				}
				
		if sign_outside_p2s_`x' == 1 {	
				local sign_outside_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_outside_`x' = "`est_outside_`x''**"
				}
				
		if sign_outside_p3s_`x' == 1 {	
				local sign_outside_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_outside_`x' = "`est_outside_`x''***"
				}
			
		if sign_outside_m1s_`x' == 1 {
				local sign_outside_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_outside_`x' = "`est_outside_`x''*"
				}
				
		if sign_outside_m2s_`x' == 1 {	
				local sign_outside_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_outside_`x' = "`est_outside_`x''**"
				}
				
		if sign_outside_m3s_`x' == 1 {	
				local sign_outside_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_outside_`x' = "`est_outside_`x''***"
				}
			
		if sign_outside_zero_`x' == 1 {
			local sign_outside_`x' = "0"
			}
		
		drop sign_*
		
		}
		
	* Subgroup Effects: Embededness Index
	
	foreach x in `indices' {
	
		areg e_`x' treatfull treatfull_embededness b_h_embed_index_z_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		eststo e_`x'_embededness
		local n_embed_`x' = string(e(N),"%9.0fc")
		local r2_embed_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_embededness
		local est_embed_`x' = r(estimate)
		local se_embed_`x' = r(se)
		test treatfull + treatfull_embededness = 0
		local p_embed_`x' = r(p)
		
		local est_bembed_`x' = string(_b[treatfull],"%9.3fc")
		local se_bembed_`x' = string(_se[treatfull],"%9.3fc")
		local p_bembed_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxembed_`x' = string(_b[treatfull_embededness],"%9.3fc")
		local se_tmxembed_`x' = string(_se[treatfull_embededness],"%9.3fc")
		local p_tmxembed_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_embededness]/_se[treatfull_embededness])))
		
		local est_smembed_`x' = string(_b[b_h_embed_index_z_med_d],"%9.3fc")
		local se_smembed_`x' = string(_se[b_h_embed_index_z_med_d],"%9.3fc")
		local p_smembed_`x' = (2 * ttail(e(df_r), abs(_b[b_h_embed_index_z_med_d]/_se[b_h_embed_index_z_med_d])))
		
		local est_cembed_`x' = string(_b[_cons],"%9.3fc")
		local se_cembed_`x' = string(_se[_cons],"%9.3fc")
		local p_cembed_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bembed tmxembed smembed cembed {
			
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
				
		gen sign_embed_zero_`x' = (`p_embed_`x''>0.1)
		gen sign_embed_p1s_`x' = (`p_embed_`x''<=0.1 & `p_embed_`x''>0.05 & `est_embed_`x''>0)
		gen sign_embed_p2s_`x' = (`p_embed_`x''<=0.05 & `p_embed_`x''>0.01 & `est_embed_`x''>0)
		gen sign_embed_p3s_`x' = (`p_embed_`x''<=0.01 & `p_embed_`x''>=0 & `est_embed_`x''>0)
		gen sign_embed_m1s_`x' = (`p_embed_`x''<=0.1 & `p_embed_`x''>0.05 & `est_embed_`x''<0)
		gen sign_embed_m2s_`x' = (`p_embed_`x''<=0.05 & `p_embed_`x''>0.01 & `est_embed_`x''<0)
		gen sign_embed_m3s_`x' = (`p_embed_`x''<=0.01 & `p_embed_`x''>=0 & `est_embed_`x''<0)
		
		local p_embed_`x' = string(`p_embed_`x'',"%9.3fc")
		local est_embed_`x' = string(`est_embed_`x'',"%9.3fc")
		local se_embed_`x' = string(`se_embed_`x'',"%9.3fc")
		
		if sign_embed_p1s_`x' == 1 {
				local sign_embed_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_embed_`x' = "`est_embed_`x''*"
				}
				
		if sign_embed_p2s_`x' == 1 {	
				local sign_embed_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_embed_`x' = "`est_embed_`x''**"
				}
				
		if sign_embed_p3s_`x' == 1 {	
				local sign_embed_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_embed_`x' = "`est_embed_`x''***"
				}
			
		if sign_embed_m1s_`x' == 1 {
				local sign_embed_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_embed_`x' = "`est_embed_`x''*"
				}
				
		if sign_embed_m2s_`x' == 1 {	
				local sign_embed_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_embed_`x' = "`est_embed_`x''**"
				}
				
		if sign_embed_m3s_`x' == 1 {	
				local sign_embed_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_embed_`x' = "`est_embed_`x''***"
				}
			
		if sign_embed_zero_`x' == 1 {
			local sign_embed_`x' = "0"
			}
		
		drop sign_*
		
		}
		
	* Subgroup Effects: Collective Action Potential
	
	foreach x in `indices' {
	
		areg e_`x' treatfull treatfull_capotential b_capotential_z_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		eststo e_`x'_cap
		local n_cap_`x' = string(e(N),"%9.0fc")
		local r2_cap_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_capotential
		local est_cap_`x' = r(estimate)
		local se_cap_`x' = r(se)
		test treatfull + treatfull_capotential = 0
		local p_cap_`x' = r(p)
		
		local est_bcap_`x' = string(_b[treatfull],"%9.3fc")
		local se_bcap_`x' = string(_se[treatfull],"%9.3fc")
		local p_bcap_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxcap_`x' = string(_b[treatfull_capotential],"%9.3fc")
		local se_tmxcap_`x' = string(_se[treatfull_capotential],"%9.3fc")
		local p_tmxcap_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_capotential]/_se[treatfull_capotential])))
		
		local est_smcap_`x' = string(_b[b_capotential_z_med_d],"%9.3fc")
		local se_smcap_`x' = string(_se[b_capotential_z_med_d],"%9.3fc")
		local p_smcap_`x' = (2 * ttail(e(df_r), abs(_b[b_capotential_z_med_d]/_se[b_capotential_z_med_d])))
		
		local est_ccap_`x' = string(_b[_cons],"%9.3fc")
		local se_ccap_`x' = string(_se[_cons],"%9.3fc")
		local p_ccap_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bcap tmxcap smcap ccap {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
			
		gen sign_cap_zero_`x' = (`p_cap_`x''>0.1)
		gen sign_cap_p1s_`x' = (`p_cap_`x''<=0.1 & `p_cap_`x''>0.05 & `est_cap_`x''>0)
		gen sign_cap_p2s_`x' = (`p_cap_`x''<=0.05 & `p_cap_`x''>0.01 & `est_cap_`x''>0)
		gen sign_cap_p3s_`x' = (`p_cap_`x''<=0.01 & `p_cap_`x''>=0 & `est_cap_`x''>0)
		gen sign_cap_m1s_`x' = (`p_cap_`x''<=0.1 & `p_cap_`x''>0.05 & `est_cap_`x''<0)
		gen sign_cap_m2s_`x' = (`p_cap_`x''<=0.05 & `p_cap_`x''>0.01 & `est_cap_`x''<0)
		gen sign_cap_m3s_`x' = (`p_cap_`x''<=0.01 & `p_cap_`x''>=0 & `est_cap_`x''<0)
		
		local p_cap_`x' = string(`p_cap_`x'',"%9.3fc")
		local est_cap_`x' = string(`est_cap_`x'',"%9.3fc")
		local se_cap_`x' = string(`se_cap_`x'',"%9.3fc")
		
		if sign_cap_p1s_`x' == 1 {
				local sign_cap_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_cap_`x' = "`est_cap_`x''*"
				}
				
		if sign_cap_p2s_`x' == 1 {	
				local sign_cap_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_cap_`x' = "`est_cap_`x''**"
				}
				
		if sign_cap_p3s_`x' == 1 {	
				local sign_cap_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_cap_`x' = "`est_cap_`x''***"
				}
			
		if sign_cap_m1s_`x' == 1 {
				local sign_cap_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_cap_`x' = "`est_cap_`x''*"
				}
				
		if sign_cap_m2s_`x' == 1 {	
				local sign_cap_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_cap_`x' = "`est_cap_`x''**"
				}
				
		if sign_cap_m3s_`x' == 1 {	
				local sign_cap_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_cap_`x' = "`est_cap_`x''***"
				}
			
		if sign_cap_zero_`x' == 1 {
			local sign_cap_`x' = "0"
			}
		
		drop sign_*
		
		}
	
	
	* Subgroup Effects: Community Monitoring
	
	* We create the vector of controls with HC level components
	
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_hc
		
		local `x'controls_tfull
		local `x'controls_tfull_hc
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
		
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			
			}
		}
				
	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		
		local e_controls_hc `e_controls_hc' c_hc_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
		
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			
			}
		}
		
	* We regress the results
	
	foreach x in `indices' {
	
		areg e_`x' treatfull treatfull_commtg b_commtg_z_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		eststo e_`x'_commtg
		local n_commtg_`x' = string(e(N),"%9.0fc")
		local r2_commtg_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_commtg
		local est_commtg_`x' = r(estimate)
		local se_commtg_`x' = r(se)
		test treatfull + treatfull_commtg = 0
		local p_commtg_`x' = r(p)
		
		local est_bcommtg_`x' = string(_b[treatfull],"%9.3fc")
		local se_bcommtg_`x' = string(_se[treatfull],"%9.3fc")
		local p_bcommtg_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxcommtg_`x' = string(_b[treatfull_commtg],"%9.3fc")
		local se_tmxcommtg_`x' = string(_se[treatfull_commtg],"%9.3fc")
		local p_tmxcommtg_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_commtg]/_se[treatfull_commtg])))
		
		local est_smcommtg_`x' = string(_b[b_commtg_z_med_d],"%9.3fc")
		local se_smcommtg_`x' = string(_se[b_commtg_z_med_d],"%9.3fc")
		local p_smcommtg_`x' = (2 * ttail(e(df_r), abs(_b[b_commtg_z_med_d]/_se[b_commtg_z_med_d])))
		
		local est_ccommtg_`x' = string(_b[_cons],"%9.3fc")
		local se_ccommtg_`x' = string(_se[_cons],"%9.3fc")
		local p_ccommtg_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bcommtg tmxcommtg smcommtg ccommtg {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
			
		gen sign_commtg_zero_`x' = (`p_commtg_`x''>0.1)
		gen sign_commtg_p1s_`x' = (`p_commtg_`x''<=0.1 & `p_commtg_`x''>0.05 & `est_commtg_`x''>0)
		gen sign_commtg_p2s_`x' = (`p_commtg_`x''<=0.05 & `p_commtg_`x''>0.01 & `est_commtg_`x''>0)
		gen sign_commtg_p3s_`x' = (`p_commtg_`x''<=0.01 & `p_commtg_`x''>=0 & `est_commtg_`x''>0)
		gen sign_commtg_m1s_`x' = (`p_commtg_`x''<=0.1 & `p_commtg_`x''>0.05 & `est_commtg_`x''<0)
		gen sign_commtg_m2s_`x' = (`p_commtg_`x''<=0.05 & `p_commtg_`x''>0.01 & `est_commtg_`x''<0)
		gen sign_commtg_m3s_`x' = (`p_commtg_`x''<=0.01 & `p_commtg_`x''>=0 & `est_commtg_`x''<0)
		
		local p_commtg_`x' = string(`p_commtg_`x'',"%9.3fc")
		local est_commtg_`x' = string(`est_commtg_`x'',"%9.3fc")
		local se_commtg_`x' = string(`se_commtg_`x'',"%9.3fc")
		
		if sign_commtg_p1s_`x' == 1 {
				local sign_commtg_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_commtg_`x' = "`est_commtg_`x''*"
				}
				
		if sign_commtg_p2s_`x' == 1 {	
				local sign_commtg_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_commtg_`x' = "`est_commtg_`x''**"
				}
				
		if sign_commtg_p3s_`x' == 1 {	
				local sign_commtg_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_commtg_`x' = "`est_commtg_`x''***"
				}
			
		if sign_commtg_m1s_`x' == 1 {
				local sign_commtg_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_commtg_`x' = "`est_commtg_`x''*"
				}
				
		if sign_commtg_m2s_`x' == 1 {	
				local sign_commtg_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_commtg_`x' = "`est_commtg_`x''**"
				}
				
		if sign_commtg_m3s_`x' == 1 {	
				local sign_commtg_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_commtg_`x' = "`est_commtg_`x''***"
				}
			
		if sign_commtg_zero_`x' == 1 {
			local sign_commtg_`x' = "0"
			}
		
		drop sign_*
		
		}
		
	* Subgroup Effects: Efficacy
	
	* We regress the results
	
	foreach x in `indices' {
	
		areg e_`x' treatfull treatfull_eff b_eff_z_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		eststo e_`x'_eff
		local n_eff_`x' = string(e(N),"%9.0fc")
		local r2_eff_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_eff
		local est_eff_`x' = r(estimate)
		local se_eff_`x' = r(se)
		test treatfull + treatfull_eff = 0
		local p_eff_`x' = r(p)
		
		local est_beff_`x' = string(_b[treatfull],"%9.3fc")
		local se_beff_`x' = string(_se[treatfull],"%9.3fc")
		local p_beff_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxeff_`x' = string(_b[treatfull_eff],"%9.3fc")
		local se_tmxeff_`x' = string(_se[treatfull_eff],"%9.3fc")
		local p_tmxeff_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_eff]/_se[treatfull_eff])))
		
		local est_smeff_`x' = string(_b[b_eff_z_med_d],"%9.3fc")
		local se_smeff_`x' = string(_se[b_eff_z_med_d],"%9.3fc")
		local p_smeff_`x' = (2 * ttail(e(df_r), abs(_b[b_eff_z_med_d]/_se[b_eff_z_med_d])))
		
		local est_ceff_`x' = string(_b[_cons],"%9.3fc")
		local se_ceff_`x' = string(_se[_cons],"%9.3fc")
		local p_ceff_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in beff tmxeff smeff ceff {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
			
		gen sign_eff_zero_`x' = (`p_eff_`x''>0.1)
		gen sign_eff_p1s_`x' = (`p_eff_`x''<=0.1 & `p_eff_`x''>0.05 & `est_eff_`x''>0)
		gen sign_eff_p2s_`x' = (`p_eff_`x''<=0.05 & `p_eff_`x''>0.01 & `est_eff_`x''>0)
		gen sign_eff_p3s_`x' = (`p_eff_`x''<=0.01 & `p_eff_`x''>=0 & `est_eff_`x''>0)
		gen sign_eff_m1s_`x' = (`p_eff_`x''<=0.1 & `p_eff_`x''>0.05 & `est_eff_`x''<0)
		gen sign_eff_m2s_`x' = (`p_eff_`x''<=0.05 & `p_eff_`x''>0.01 & `est_eff_`x''<0)
		gen sign_eff_m3s_`x' = (`p_eff_`x''<=0.01 & `p_eff_`x''>=0 & `est_eff_`x''<0)
		
		local p_eff_`x' = string(`p_eff_`x'',"%9.3fc")
		local est_eff_`x' = string(`est_eff_`x'',"%9.3fc")
		local se_eff_`x' = string(`se_eff_`x'',"%9.3fc")
		
		if sign_eff_p1s_`x' == 1 {
				local sign_eff_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_eff_`x' = "`est_eff_`x''*"
				}
				
		if sign_eff_p2s_`x' == 1 {	
				local sign_eff_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_eff_`x' = "`est_eff_`x''**"
				}
				
		if sign_eff_p3s_`x' == 1 {	
				local sign_eff_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_eff_`x' = "`est_eff_`x''***"
				}
			
		if sign_eff_m1s_`x' == 1 {
				local sign_eff_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_eff_`x' = "`est_eff_`x''*"
				}
				
		if sign_eff_m2s_`x' == 1 {	
				local sign_eff_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_eff_`x' = "`est_eff_`x''**"
				}
				
		if sign_eff_m3s_`x' == 1 {	
				local sign_eff_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_eff_`x' = "`est_eff_`x''***"
				}
			
		if sign_eff_zero_`x' == 1 {
			local sign_eff_`x' = "0"
			}
		
		drop sign_*
		
		}

		
	* Subgroup Effects: Distance to HC
	
	* We local the vector of control variable without HC level components
	
	local  e_controls_noprefix b_visited_d educyr b_assetindex
		
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_hc
		
		local `x'controls_tfull
		local `x'controls_tfull_hc
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
		
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			
			}
		}
				
	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		
		local e_controls_hc `e_controls_hc' c_hc_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
		
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			
			}
		}
	
	* We regress the results
	
	foreach x in `indices' {
	
		areg e_`x' treatfull treatfull_distance b_distance_hc_z_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		eststo e_`x'_distance
		local n_distance_`x' = string(e(N),"%9.0fc")
		local r2_distance_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_distance
		local est_distance_`x' = r(estimate)
		local se_distance_`x' = r(se)
		test treatfull + treatfull_distance = 0
		local p_distance_`x' = r(p)
		
		local est_bdistance_`x' = string(_b[treatfull],"%9.3fc")
		local se_bdistance_`x' = string(_se[treatfull],"%9.3fc")
		local p_bdistance_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxdist_`x' = string(_b[treatfull_distance],"%9.3fc")
		local se_tmxdist_`x' = string(_se[treatfull_distance],"%9.3fc")
		local p_tmxdist_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_distance]/_se[treatfull_distance])))
		
		local est_smdist_`x' = string(_b[b_distance_hc_z_med_d],"%9.3fc")
		local se_smdist_`x' = string(_se[b_distance_hc_z_med_d],"%9.3fc")
		local p_smdist_`x' = (2 * ttail(e(df_r), abs(_b[b_distance_hc_z_med_d]/_se[b_distance_hc_z_med_d])))
		
		local est_cdist_`x' = string(_b[_cons],"%9.3fc")
		local se_cdist_`x' = string(_se[_cons],"%9.3fc")
		local p_cdist_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bdistance tmxdist smdist cdist {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
			
		gen sign_distance_zero_`x' = (`p_distance_`x''>0.1)
		gen sign_distance_p1s_`x' = (`p_distance_`x''<=0.1 & `p_distance_`x''>0.05 & `est_distance_`x''>0)
		gen sign_distance_p2s_`x' = (`p_distance_`x''<=0.05 & `p_distance_`x''>0.01 & `est_distance_`x''>0)
		gen sign_distance_p3s_`x' = (`p_distance_`x''<=0.01 & `p_distance_`x''>=0 & `est_distance_`x''>0)
		gen sign_distance_m1s_`x' = (`p_distance_`x''<=0.1 & `p_distance_`x''>0.05 & `est_distance_`x''<0)
		gen sign_distance_m2s_`x' = (`p_distance_`x''<=0.05 & `p_distance_`x''>0.01 & `est_distance_`x''<0)
		gen sign_distance_m3s_`x' = (`p_distance_`x''<=0.01 & `p_distance_`x''>=0 & `est_distance_`x''<0)
		
		local p_distance_`x' = string(`p_distance_`x'',"%9.3fc")
		local est_distance_`x' = string(`est_distance_`x'',"%9.3fc")
		local se_distance_`x' = string(`se_distance_`x'',"%9.3fc")
		
		if sign_distance_p1s_`x' == 1 {
				local sign_distance_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_distance_`x' = "`est_distance_`x''*"
				}
				
		if sign_distance_p2s_`x' == 1 {	
				local sign_distance_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_distance_`x' = "`est_distance_`x''**"
				}
				
		if sign_distance_p3s_`x' == 1 {	
				local sign_distance_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_distance_`x' = "`est_distance_`x''***"
				}
			
		if sign_distance_m1s_`x' == 1 {
				local sign_distance_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_distance_`x' = "`est_distance_`x''*"
				}
				
		if sign_distance_m2s_`x' == 1 {	
				local sign_distance_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_distance_`x' = "`est_distance_`x''**"
				}
				
		if sign_distance_m3s_`x' == 1 {	
				local sign_distance_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_distance_`x' = "`est_distance_`x''***"
				}
			
		if sign_distance_zero_`x' == 1 {
			local sign_distance_`x' = "0"
			}
		
		drop sign_*
		
		}

	
	* Subgroup Effects: Urban Area
	
	foreach x in `indices' {
	
		areg e_`x' treatfull treatfull_urbanarea b_h_urb_area b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		eststo e_`x'_urbanarea
		local n_urbanarea_`x' = string(e(N),"%9.0fc")
		local r2_urbanarea_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_urbanarea
		local est_urbanarea_`x' = r(estimate)
		local se_urbanarea_`x' = r(se)
		test treatfull + treatfull_urbanarea = 0
		local p_urbanarea_`x' = r(p)
		
		local est_ruralarea_`x' = string(_b[treatfull],"%9.3fc")
		local se_ruralarea_`x' = string(_se[treatfull],"%9.3fc")
		local p_ruralarea_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxrural_`x' = string(_b[treatfull_urbanarea],"%9.3fc")
		local se_tmxrural_`x' = string(_se[treatfull_urbanarea],"%9.3fc")
		local p_tmxrural_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_urbanarea]/_se[treatfull_urbanarea])))
			
		local est_smrural_`x' = string(_b[b_h_urb_area],"%9.3fc")
		local se_smrural_`x' = string(_se[b_h_urb_area],"%9.3fc")
		local p_smrural_`x' = (2 * ttail(e(df_r), abs(_b[b_h_urb_area]/_se[b_h_urb_area])))
		
		local est_crural_`x' = string(_b[_cons],"%9.3fc")
		local se_crural_`x' = string(_se[_cons],"%9.3fc")
		local p_crural_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in ruralarea tmxrural smrural crural {
			
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
		
		gen sign_urbanarea_zero_`x' = (`p_urbanarea_`x''>0.1)
		gen sign_urbanarea_p1s_`x' = (`p_urbanarea_`x''<=0.1 & `p_urbanarea_`x''>0.05 & `est_urbanarea_`x''>0)
		gen sign_urbanarea_p2s_`x' = (`p_urbanarea_`x''<=0.05 & `p_urbanarea_`x''>0.01 & `est_urbanarea_`x''>0)
		gen sign_urbanarea_p3s_`x' = (`p_urbanarea_`x''<=0.01 & `p_urbanarea_`x''>=0 & `est_urbanarea_`x''>0)
		gen sign_urbanarea_m1s_`x' = (`p_urbanarea_`x''<=0.1 & `p_urbanarea_`x''>0.05 & `est_urbanarea_`x''<0)
		gen sign_urbanarea_m2s_`x' = (`p_urbanarea_`x''<=0.05 & `p_urbanarea_`x''>0.01 & `est_urbanarea_`x''<0)
		gen sign_urbanarea_m3s_`x' = (`p_urbanarea_`x''<=0.01 & `p_urbanarea_`x''>=0 & `est_urbanarea_`x''<0)
		
		local p_urbanarea_`x' = string(`p_urbanarea_`x'',"%9.3fc")
		local est_urbanarea_`x' = string(`est_urbanarea_`x'',"%9.3fc")
		local se_urbanarea_`x' = string(`se_urbanarea_`x'',"%9.3fc")
		
		if sign_urbanarea_p1s_`x' == 1 {
				local sign_urbanarea_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_urbanarea_`x' = "`est_urbanarea_`x''*"
				}
				
		if sign_urbanarea_p2s_`x' == 1 {	
				local sign_urbanarea_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_urbanarea_`x' = "`est_urbanarea_`x''**"
				}
				
		if sign_urbanarea_p3s_`x' == 1 {	
				local sign_urbanarea_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_urbanarea_`x' = "`est_urbanarea_`x''***"
				}
			
		if sign_urbanarea_m1s_`x' == 1 {
				local sign_urbanarea_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_urbanarea_`x' = "`est_urbanarea_`x''*"
				}
				
		if sign_urbanarea_m2s_`x' == 1 {	
				local sign_urbanarea_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_urbanarea_`x' = "`est_urbanarea_`x''**"
				}
				
		if sign_urbanarea_m3s_`x' == 1 {	
				local sign_urbanarea_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_urbanarea_`x' = "`est_urbanarea_`x''***"
				}
			
		if sign_urbanarea_zero_`x' == 1 {
			local sign_urbanarea_`x' = "0"
			}
		
		drop sign_*
		
		}

	
	* Subgroup Effects: Presence of NGO
	
	foreach x in `indices' {
	
		areg e_`x' treatfull treatfull_ngo_hc b_ngo_hc b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		eststo e_`x'_ngo
		local n_ngo_`x' = string(e(N),"%9.0fc")
		local r2_ngo_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_ngo_hc
		local est_ngo_`x' = r(estimate)
		local se_ngo_`x' = r(se)
		test treatfull + treatfull_ngo_hc = 0
		local p_ngo_`x' = r(p)
		
		local est_bngo_`x' = string(_b[treatfull],"%9.3fc")
		local se_bngo_`x' = string(_se[treatfull],"%9.3fc")
		local p_bngo_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxngo_`x' = string(_b[treatfull_ngo_hc],"%9.3fc")
		local se_tmxngo_`x' = string(_se[treatfull_ngo_hc],"%9.3fc")
		local p_tmxngo_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_ngo_hc]/_se[treatfull_ngo_hc])))
		
		local est_smngo_`x' = string(_b[b_ngo_hc],"%9.3fc")
		local se_smngo_`x' = string(_se[b_ngo_hc],"%9.3fc")
		local p_smngo_`x' = (2 * ttail(e(df_r), abs(_b[b_ngo_hc]/_se[b_ngo_hc])))
		
		local est_cngo_`x' = string(_b[_cons],"%9.3fc")
		local se_cngo_`x' = string(_se[_cons],"%9.3fc")
		local p_cngo_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bngo tmxngo smngo cngo {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
			
		gen sign_ngo_zero_`x' = (`p_ngo_`x''>0.1)
		gen sign_ngo_p1s_`x' = (`p_ngo_`x''<=0.1 & `p_ngo_`x''>0.05 & `est_ngo_`x''>0)
		gen sign_ngo_p2s_`x' = (`p_ngo_`x''<=0.05 & `p_ngo_`x''>0.01 & `est_ngo_`x''>0)
		gen sign_ngo_p3s_`x' = (`p_ngo_`x''<=0.01 & `p_ngo_`x''>=0 & `est_ngo_`x''>0)
		gen sign_ngo_m1s_`x' = (`p_ngo_`x''<=0.1 & `p_ngo_`x''>0.05 & `est_ngo_`x''<0)
		gen sign_ngo_m2s_`x' = (`p_ngo_`x''<=0.05 & `p_ngo_`x''>0.01 & `est_ngo_`x''<0)
		gen sign_ngo_m3s_`x' = (`p_ngo_`x''<=0.01 & `p_ngo_`x''>=0 & `est_ngo_`x''<0)
		
		local p_ngo_`x' = string(`p_ngo_`x'',"%9.3fc")
		local est_ngo_`x' = string(`est_ngo_`x'',"%9.3fc")
		local se_ngo_`x' = string(`se_ngo_`x'',"%9.3fc")
		
		if sign_ngo_p1s_`x' == 1 {
				local sign_ngo_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_ngo_`x' = "`est_ngo_`x''*"
				}
				
		if sign_ngo_p2s_`x' == 1 {	
				local sign_ngo_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_ngo_`x' = "`est_ngo_`x''**"
				}
				
		if sign_ngo_p3s_`x' == 1 {	
				local sign_ngo_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_ngo_`x' = "`est_ngo_`x''***"
				}
			
		if sign_ngo_m1s_`x' == 1 {
				local sign_ngo_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_ngo_`x' = "`est_ngo_`x''*"
				}
				
		if sign_ngo_m2s_`x' == 1 {	
				local sign_ngo_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_ngo_`x' = "`est_ngo_`x''**"
				}
				
		if sign_ngo_m3s_`x' == 1 {	
				local sign_ngo_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_ngo_`x' = "`est_ngo_`x''***"
				}
			
		if sign_ngo_zero_`x' == 1 {
			local sign_ngo_`x' = "0"
			}
			
		drop sign_*

		}
		
	* Subgroup Effects: Baseline U5M
	
	foreach x in `indices' {
	
		areg e_`x' treatfull treatfull_u5m_hc b_h_u5mortality_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		eststo e_`x'_u5m
		local n_u5m_`x' = string(e(N),"%9.0fc")
		local r2_u5m_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_u5m_hc
		local est_u5m_`x' = r(estimate)
		local se_u5m_`x' = r(se)
		test treatfull + treatfull_u5m_hc = 0
		local p_u5m_`x' = r(p)
		
		local est_bu5m_`x' = string(_b[treatfull],"%9.3fc")
		local se_bu5m_`x' = string(_se[treatfull],"%9.3fc")
		local p_bu5m_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxu5m_`x' = string(_b[treatfull_u5m_hc],"%9.3fc")
		local se_tmxu5m_`x' = string(_se[treatfull_u5m_hc],"%9.3fc")
		local p_tmxu5m_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_u5m_hc]/_se[treatfull_u5m_hc])))
		
		local est_smu5m_`x' = string(_b[b_h_u5mortality_med_d],"%9.3fc")
		local se_smu5m_`x' = string(_se[b_h_u5mortality_med_d],"%9.3fc")
		local p_smu5m_`x' = (2 * ttail(e(df_r), abs(_b[b_h_u5mortality_med_d]/_se[b_h_u5mortality_med_d])))
		
		local est_cu5m_`x' = string(_b[_cons],"%9.3fc")
		local se_cu5m_`x' = string(_se[_cons],"%9.3fc")
		local p_cu5m_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bu5m tmxu5m smu5m cu5m {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
			
		gen sign_u5m_zero_`x' = (`p_u5m_`x''>0.1)
		gen sign_u5m_p1s_`x' = (`p_u5m_`x''<=0.1 & `p_u5m_`x''>0.05 & `est_u5m_`x''>0)
		gen sign_u5m_p2s_`x' = (`p_u5m_`x''<=0.05 & `p_u5m_`x''>0.01 & `est_u5m_`x''>0)
		gen sign_u5m_p3s_`x' = (`p_u5m_`x''<=0.01 & `p_u5m_`x''>=0 & `est_u5m_`x''>0)
		gen sign_u5m_m1s_`x' = (`p_u5m_`x''<=0.1 & `p_u5m_`x''>0.05 & `est_u5m_`x''<0)
		gen sign_u5m_m2s_`x' = (`p_u5m_`x''<=0.05 & `p_u5m_`x''>0.01 & `est_u5m_`x''<0)
		gen sign_u5m_m3s_`x' = (`p_u5m_`x''<=0.01 & `p_u5m_`x''>=0 & `est_u5m_`x''<0)
		
		local p_u5m_`x' = string(`p_u5m_`x'',"%9.3fc")
		local est_u5m_`x' = string(`est_u5m_`x'',"%9.3fc")
		local se_u5m_`x' = string(`se_u5m_`x'',"%9.3fc")
		
		if sign_u5m_p1s_`x' == 1 {
				local sign_u5m_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_u5m_`x' = "`est_u5m_`x''*"
				}
				
		if sign_u5m_p2s_`x' == 1 {	
				local sign_u5m_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_u5m_`x' = "`est_u5m_`x''**"
				}
				
		if sign_u5m_p3s_`x' == 1 {	
				local sign_u5m_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_u5m_`x' = "`est_u5m_`x''***"
				}
			
		if sign_u5m_m1s_`x' == 1 {
				local sign_u5m_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_u5m_`x' = "`est_u5m_`x''*"
				}
				
		if sign_u5m_m2s_`x' == 1 {	
				local sign_u5m_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_u5m_`x' = "`est_u5m_`x''**"
				}
				
		if sign_u5m_m3s_`x' == 1 {	
				local sign_u5m_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_u5m_`x' = "`est_u5m_`x''***"
				}
			
		if sign_u5m_zero_`x' == 1 {
			local sign_u5m_`x' = "0"
			}
			
		drop sign_*

		}

		
	* Child mortality for HC level
	
	* We create the control vector without HC level components
	
	local  e_controls_noprefix b_visited_d educyr b_assetindex
	
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_hc
		
		local `x'controls_tfull
		local `x'controls_tfull_hc
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
		
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			
			}
		}
				
	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		
		local e_controls_hc `e_controls_hc' c_hc_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
		
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			
			}
		}
	
	* Subgroup Effects: Health Centre 2
	
	foreach x in `indices_hc' {
	
		areg e_`x' treatfull treatfull_hc2 hc2 b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_hc2
		local n_hc3_`x' = string(e(N),"%9.0fc")
		local r2_hc3_`x' = string(e(r2),"%9.3fc")

		lincom treatfull + treatfull_hc2 
		local est_hc2_`x' = r(estimate)
		local se_hc2_`x' = r(se)
		test treatfull + treatfull_hc2 = 0
		local p_hc2_`x' = r(p)
		
		local est_hc3_`x' = string(_b[treatfull],"%9.3fc")
		local se_hc3_`x' = string(_se[treatfull],"%9.3fc")
		local p_hc3_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxhc3_`x' = string(_b[treatfull_hc2],"%9.3fc")
		local se_tmxhc3_`x' = string(_se[treatfull_hc2],"%9.3fc")
		local p_tmxhc3_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_hc2]/_se[treatfull_hc2])))
		
		local est_smhc3_`x' = string(_b[hc2],"%9.3fc")
		local se_smhc3_`x' = string(_se[hc2],"%9.3fc")
		local p_smhc3_`x' = (2 * ttail(e(df_r), abs(_b[hc2]/_se[hc2])))
		
		local est_chc3_`x' = string(_b[_cons],"%9.3fc")
		local se_chc3_`x' = string(_se[_cons],"%9.3fc")
		local p_chc3_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in hc3 tmxhc3 smhc3 chc3 {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			

			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
		
		gen sign_hc2_zero_`x' = (`p_hc2_`x''>0.1)
		gen sign_hc2_p1s_`x' = (`p_hc2_`x''<=0.1 & `p_hc2_`x''>0.05 & `est_hc2_`x''>0)
		gen sign_hc2_p2s_`x' = (`p_hc2_`x''<=0.05 & `p_hc2_`x''>0.01 & `est_hc2_`x''>0)
		gen sign_hc2_p3s_`x' = (`p_hc2_`x''<=0.01 & `p_hc2_`x''>=0 & `est_hc2_`x''>0)
		gen sign_hc2_m1s_`x' = (`p_hc2_`x''<=0.1 & `p_hc2_`x''>0.05 & `est_hc2_`x''<0)
		gen sign_hc2_m2s_`x' = (`p_hc2_`x''<=0.05 & `p_hc2_`x''>0.01 & `est_hc2_`x''<0)
		gen sign_hc2_m3s_`x' = (`p_hc2_`x''<=0.01 & `p_hc2_`x''>=0 & `est_hc2_`x''<0)
		
		local p_hc2_`x' = string(`p_hc2_`x'',"%9.3fc")
		local est_hc2_`x' = string(`est_hc2_`x'',"%9.3fc")
		local se_hc2_`x' = string(`se_hc2_`x'',"%9.3fc")
		
		if sign_hc2_p1s_`x' == 1 {
				local sign_hc2_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_hc2_`x' = "`est_hc2_`x''*"
				}
				
		if sign_hc2_p2s_`x' == 1 {	
				local sign_hc2_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_hc2_`x' = "`est_hc2_`x''**"
				}
				
		if sign_hc2_p3s_`x' == 1 {	
				local sign_hc2_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_hc2_`x' = "`est_hc2_`x''***"
				}
			
		if sign_hc2_m1s_`x' == 1 {
				local sign_hc2_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_hc2_`x' = "`est_hc2_`x''*"
				}
				
		if sign_hc2_m2s_`x' == 1 {	
				local sign_hc2_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_hc2_`x' = "`est_hc2_`x''**"
				}
				
		if sign_hc2_m3s_`x' == 1 {	
				local sign_hc2_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_hc2_`x' = "`est_hc2_`x''***"
				}
			
		if sign_hc2_zero_`x' == 1 {
			local sign_hc2_`x' = "0"
			}
		
		drop sign_*

		}
		
	* Subgroup effects: Treatment Quality
	
	* We local the vector of control with HC level subcomponents
	
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_hc
		
		local `x'controls_tfull
		local `x'controls_tfull_hc
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
		
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			
			}
		}
				
	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		
		local e_controls_hc `e_controls_hc' c_hc_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
		
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			
			}
		}
		
	* We regress the results
	
	foreach x in `indices_hc' {
	
		areg e_`x' treatfull treatfull_treatqual b_treatqual_z_med_d b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_treatqual
		local n_treatqual_`x' = string(e(N),"%9.0fc")
		local r2_treatqual_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_treatqual
		local est_treatqual_`x' = r(estimate)
		local se_treatqual_`x' = r(se)
		test treatfull + treatfull_treatqual = 0
		local p_treatqual_`x' = r(p)
		
		local est_btreatqual_`x' = string(_b[treatfull],"%9.3fc")
		local se_btreatqual_`x' = string(_se[treatfull],"%9.3fc")
		local p_btreatqual_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxtqual_`x' = string(_b[treatfull_treatqual],"%9.3fc")
		local se_tmxtqual_`x' = string(_se[treatfull_treatqual],"%9.3fc")
		local p_tmxtqual_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_treatqual]/_se[treatfull_treatqual])))
		
		local est_smtqual_`x' = string(_b[b_treatqual_z_med_d],"%9.3fc")
		local se_smtqual_`x' = string(_se[b_treatqual_z_med_d],"%9.3fc")
		local p_smtqual_`x' = (2 * ttail(e(df_r), abs(_b[b_treatqual_z_med_d]/_se[b_treatqual_z_med_d])))
		
		local est_ctqual_`x' = string(_b[_cons],"%9.3fc")
		local se_ctqual_`x' = string(_se[_cons],"%9.3fc")
		local p_ctqual_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in btreatqual tmxtqual smtqual ctqual {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}

		
		gen sign_treatqual_zero_`x' = (`p_treatqual_`x''>0.1)
		gen sign_treatqual_p1s_`x' = (`p_treatqual_`x''<=0.1 & `p_treatqual_`x''>0.05 & `est_treatqual_`x''>0)
		gen sign_treatqual_p2s_`x' = (`p_treatqual_`x''<=0.05 & `p_treatqual_`x''>0.01 & `est_treatqual_`x''>0)
		gen sign_treatqual_p3s_`x' = (`p_treatqual_`x''<=0.01 & `p_treatqual_`x''>=0 & `est_treatqual_`x''>0)
		gen sign_treatqual_m1s_`x' = (`p_treatqual_`x''<=0.1 & `p_treatqual_`x''>0.05 & `est_treatqual_`x''<0)
		gen sign_treatqual_m2s_`x' = (`p_treatqual_`x''<=0.05 & `p_treatqual_`x''>0.01 & `est_treatqual_`x''<0)
		gen sign_treatqual_m3s_`x' = (`p_treatqual_`x''<=0.01 & `p_treatqual_`x''>=0 & `est_treatqual_`x''<0)
		
		local p_treatqual_`x' = string(`p_treatqual_`x'',"%9.3fc")
		local est_treatqual_`x' = string(`est_treatqual_`x'',"%9.3fc")
		local se_treatqual_`x' = string(`se_treatqual_`x'',"%9.3fc")
		
		if sign_treatqual_p1s_`x' == 1 {
				local sign_treatqual_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_treatqual_`x' = "`est_treatqual_`x''*"
				}
				
		if sign_treatqual_p2s_`x' == 1 {	
				local sign_treatqual_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_treatqual_`x' = "`est_treatqual_`x''**"
				}
				
		if sign_treatqual_p3s_`x' == 1 {	
				local sign_treatqual_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_treatqual_`x' = "`est_treatqual_`x''***"
				}
			
		if sign_treatqual_m1s_`x' == 1 {
				local sign_treatqual_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_treatqual_`x' = "`est_treatqual_`x''*"
				}
				
		if sign_treatqual_m2s_`x' == 1 {	
				local sign_treatqual_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_treatqual_`x' = "`est_treatqual_`x''**"
				}
				
		if sign_treatqual_m3s_`x' == 1 {	
				local sign_treatqual_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_treatqual_`x' = "`est_treatqual_`x''***"
				}
			
		if sign_treatqual_zero_`x' == 1 {
			local sign_treatqual_`x' = "0"
			}
		
		drop sign_*
		
		}

		
	* Subgroup Effects: Outside Options
	
	* We local the vector of contral without HC level components
	
	local  e_controls_noprefix b_visited_d educyr b_assetindex
		
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_hc
		
		local `x'controls_tfull
		local `x'controls_tfull_hc
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
		
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			
			}
		}
				
	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		
		local e_controls_hc `e_controls_hc' c_hc_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
		
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			
			}
		}
	
	* We regress the results
	
	foreach x in `indices_hc' {
	
		areg e_`x' treatfull treatfull_outsideoption b_h_outsideoption_z_med_d b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_outsideoption
		local n_outside_`x' = string(e(N),"%9.0fc")
		local r2_outside_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_outsideoption
		local est_outside_`x' = r(estimate)
		local se_outside_`x' = r(se)
		test treatfull + treatfull_outsideoption = 0
		local p_outside_`x' = r(p)
		
		local est_boutside_`x' = string(_b[treatfull],"%9.3fc")
		local se_boutside_`x' = string(_se[treatfull],"%9.3fc")
		local p_boutside_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxoutside_`x' = string(_b[treatfull_outsideoption],"%9.3fc")
		local se_tmxoutside_`x' = string(_se[treatfull_outsideoption],"%9.3fc")
		local p_tmxoutside_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_outsideoption]/_se[treatfull_outsideoption])))
		
		local est_smoutside_`x' = string(_b[b_h_outsideoption_z_med_d],"%9.3fc")
		local se_smoutside_`x' = string(_se[b_h_outsideoption_z_med_d],"%9.3fc")
		local p_smoutside_`x' = (2 * ttail(e(df_r), abs(_b[b_h_outsideoption_z_med_d]/_se[b_h_outsideoption_z_med_d])))
		
		local est_coutside_`x' = string(_b[_cons],"%9.3fc")
		local se_coutside_`x' = string(_se[_cons],"%9.3fc")
		local p_coutside_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in boutside tmxoutside smoutside coutside {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
		
		gen sign_outside_zero_`x' = (`p_outside_`x''>0.1)
		gen sign_outside_p1s_`x' = (`p_outside_`x''<=0.1 & `p_outside_`x''>0.05 & `est_outside_`x''>0)
		gen sign_outside_p2s_`x' = (`p_outside_`x''<=0.05 & `p_outside_`x''>0.01 & `est_outside_`x''>0)
		gen sign_outside_p3s_`x' = (`p_outside_`x''<=0.01 & `p_outside_`x''>=0 & `est_outside_`x''>0)
		gen sign_outside_m1s_`x' = (`p_outside_`x''<=0.1 & `p_outside_`x''>0.05 & `est_outside_`x''<0)
		gen sign_outside_m2s_`x' = (`p_outside_`x''<=0.05 & `p_outside_`x''>0.01 & `est_outside_`x''<0)
		gen sign_outside_m3s_`x' = (`p_outside_`x''<=0.01 & `p_outside_`x''>=0 & `est_outside_`x''<0)
		
		local p_outside_`x' = string(`p_outside_`x'',"%9.3fc")
		local est_outside_`x' = string(`est_outside_`x'',"%9.3fc")
		local se_outside_`x' = string(`se_outside_`x'',"%9.3fc")
		
		if sign_outside_p1s_`x' == 1 {
				local sign_outside_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_outside_`x' = "`est_outside_`x''*"
				}
				
		if sign_outside_p2s_`x' == 1 {	
				local sign_outside_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_outside_`x' = "`est_outside_`x''**"
				}
				
		if sign_outside_p3s_`x' == 1 {	
				local sign_outside_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_outside_`x' = "`est_outside_`x''***"
				}
			
		if sign_outside_m1s_`x' == 1 {
				local sign_outside_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_outside_`x' = "`est_outside_`x''*"
				}
				
		if sign_outside_m2s_`x' == 1 {	
				local sign_outside_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_outside_`x' = "`est_outside_`x''**"
				}
				
		if sign_outside_m3s_`x' == 1 {	
				local sign_outside_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_outside_`x' = "`est_outside_`x''***"
				}
			
		if sign_outside_zero_`x' == 1 {
			local sign_outside_`x' = "0"
			}
		
		drop sign_*
		
		}
		
	* Subgroup Effects: Embededness Index
	
	foreach x in `indices_hc' {
	
		areg e_`x' treatfull treatfull_embededness b_h_embed_index_z_med_d b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_embededness
		local n_embed_`x' = string(e(N),"%9.0fc")
		local r2_embed_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_embededness
		local est_embed_`x' = r(estimate)
		local se_embed_`x' = r(se)
		test treatfull + treatfull_embededness = 0
		local p_embed_`x' = r(p)
		
		local est_bembed_`x' = string(_b[treatfull],"%9.3fc")
		local se_bembed_`x' = string(_se[treatfull],"%9.3fc")
		local p_bembed_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxembed_`x' = string(_b[treatfull_embededness],"%9.3fc")
		local se_tmxembed_`x' = string(_se[treatfull_embededness],"%9.3fc")
		local p_tmxembed_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_embededness]/_se[treatfull_embededness])))
		
		local est_smembed_`x' = string(_b[b_h_embed_index_z_med_d],"%9.3fc")
		local se_smembed_`x' = string(_se[b_h_embed_index_z_med_d],"%9.3fc")
		local p_smembed_`x' = (2 * ttail(e(df_r), abs(_b[b_h_embed_index_z_med_d]/_se[b_h_embed_index_z_med_d])))
		
		local est_cembed_`x' = string(_b[_cons],"%9.3fc")
		local se_cembed_`x' = string(_se[_cons],"%9.3fc")
		local p_cembed_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bembed tmxembed smembed cembed {
			
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
				
		gen sign_embed_zero_`x' = (`p_embed_`x''>0.1)
		gen sign_embed_p1s_`x' = (`p_embed_`x''<=0.1 & `p_embed_`x''>0.05 & `est_embed_`x''>0)
		gen sign_embed_p2s_`x' = (`p_embed_`x''<=0.05 & `p_embed_`x''>0.01 & `est_embed_`x''>0)
		gen sign_embed_p3s_`x' = (`p_embed_`x''<=0.01 & `p_embed_`x''>=0 & `est_embed_`x''>0)
		gen sign_embed_m1s_`x' = (`p_embed_`x''<=0.1 & `p_embed_`x''>0.05 & `est_embed_`x''<0)
		gen sign_embed_m2s_`x' = (`p_embed_`x''<=0.05 & `p_embed_`x''>0.01 & `est_embed_`x''<0)
		gen sign_embed_m3s_`x' = (`p_embed_`x''<=0.01 & `p_embed_`x''>=0 & `est_embed_`x''<0)
		
		local p_embed_`x' = string(`p_embed_`x'',"%9.3fc")
		local est_embed_`x' = string(`est_embed_`x'',"%9.3fc")
		local se_embed_`x' = string(`se_embed_`x'',"%9.3fc")
		
		if sign_embed_p1s_`x' == 1 {
				local sign_embed_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_embed_`x' = "`est_embed_`x''*"
				}
				
		if sign_embed_p2s_`x' == 1 {	
				local sign_embed_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_embed_`x' = "`est_embed_`x''**"
				}
				
		if sign_embed_p3s_`x' == 1 {	
				local sign_embed_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_embed_`x' = "`est_embed_`x''***"
				}
			
		if sign_embed_m1s_`x' == 1 {
				local sign_embed_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_embed_`x' = "`est_embed_`x''*"
				}
				
		if sign_embed_m2s_`x' == 1 {	
				local sign_embed_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_embed_`x' = "`est_embed_`x''**"
				}
				
		if sign_embed_m3s_`x' == 1 {	
				local sign_embed_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_embed_`x' = "`est_embed_`x''***"
				}
			
		if sign_embed_zero_`x' == 1 {
			local sign_embed_`x' = "0"
			}
		
		drop sign_*
		
		}
		
	* Subgroup Effects: Collective Action Potential
	
	foreach x in `indices_hc' {
	
		areg e_`x' treatfull treatfull_capotential b_capotential_z_med_d b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_cap
		local n_cap_`x' = string(e(N),"%9.0fc")
		local r2_cap_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_capotential
		local est_cap_`x' = r(estimate)
		local se_cap_`x' = r(se)
		test treatfull + treatfull_capotential = 0
		local p_cap_`x' = r(p)
		
		local est_bcap_`x' = string(_b[treatfull],"%9.3fc")
		local se_bcap_`x' = string(_se[treatfull],"%9.3fc")
		local p_bcap_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxcap_`x' = string(_b[treatfull_capotential],"%9.3fc")
		local se_tmxcap_`x' = string(_se[treatfull_capotential],"%9.3fc")
		local p_tmxcap_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_capotential]/_se[treatfull_capotential])))
		
		local est_smcap_`x' = string(_b[b_capotential_z_med_d],"%9.3fc")
		local se_smcap_`x' = string(_se[b_capotential_z_med_d],"%9.3fc")
		local p_smcap_`x' = (2 * ttail(e(df_r), abs(_b[b_capotential_z_med_d]/_se[b_capotential_z_med_d])))
		
		local est_ccap_`x' = string(_b[_cons],"%9.3fc")
		local se_ccap_`x' = string(_se[_cons],"%9.3fc")
		local p_ccap_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bcap tmxcap smcap ccap {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
			
		gen sign_cap_zero_`x' = (`p_cap_`x''>0.1)
		gen sign_cap_p1s_`x' = (`p_cap_`x''<=0.1 & `p_cap_`x''>0.05 & `est_cap_`x''>0)
		gen sign_cap_p2s_`x' = (`p_cap_`x''<=0.05 & `p_cap_`x''>0.01 & `est_cap_`x''>0)
		gen sign_cap_p3s_`x' = (`p_cap_`x''<=0.01 & `p_cap_`x''>=0 & `est_cap_`x''>0)
		gen sign_cap_m1s_`x' = (`p_cap_`x''<=0.1 & `p_cap_`x''>0.05 & `est_cap_`x''<0)
		gen sign_cap_m2s_`x' = (`p_cap_`x''<=0.05 & `p_cap_`x''>0.01 & `est_cap_`x''<0)
		gen sign_cap_m3s_`x' = (`p_cap_`x''<=0.01 & `p_cap_`x''>=0 & `est_cap_`x''<0)
		
		local p_cap_`x' = string(`p_cap_`x'',"%9.3fc")
		local est_cap_`x' = string(`est_cap_`x'',"%9.3fc")
		local se_cap_`x' = string(`se_cap_`x'',"%9.3fc")
		
		if sign_cap_p1s_`x' == 1 {
				local sign_cap_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_cap_`x' = "`est_cap_`x''*"
				}
				
		if sign_cap_p2s_`x' == 1 {	
				local sign_cap_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_cap_`x' = "`est_cap_`x''**"
				}
				
		if sign_cap_p3s_`x' == 1 {	
				local sign_cap_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_cap_`x' = "`est_cap_`x''***"
				}
			
		if sign_cap_m1s_`x' == 1 {
				local sign_cap_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_cap_`x' = "`est_cap_`x''*"
				}
				
		if sign_cap_m2s_`x' == 1 {	
				local sign_cap_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_cap_`x' = "`est_cap_`x''**"
				}
				
		if sign_cap_m3s_`x' == 1 {	
				local sign_cap_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_cap_`x' = "`est_cap_`x''***"
				}
			
		if sign_cap_zero_`x' == 1 {
			local sign_cap_`x' = "0"
			}
		
		drop sign_*
		
		}

	
	* Subgroup Effects: Community Monitoring
	
	* We local the vector of controls with HC level components
	
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_hc
		
		local `x'controls_tfull
		local `x'controls_tfull_hc
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
		
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			
			}
		}
				
	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		
		local e_controls_hc `e_controls_hc' c_hc_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
		
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			
			}
		}
		
	* We regress the results
	
	foreach x in `indices_hc' {
	
		areg e_`x' treatfull treatfull_commtg b_commtg_z_med_d b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_commtg
		local n_commtg_`x' = string(e(N),"%9.0fc")
		local r2_commtg_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_commtg
		local est_commtg_`x' = r(estimate)
		local se_commtg_`x' = r(se)
		test treatfull + treatfull_commtg = 0
		local p_commtg_`x' = r(p)
		
		local est_bcommtg_`x' = string(_b[treatfull],"%9.3fc")
		local se_bcommtg_`x' = string(_se[treatfull],"%9.3fc")
		local p_bcommtg_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxcommtg_`x' = string(_b[treatfull_commtg],"%9.3fc")
		local se_tmxcommtg_`x' = string(_se[treatfull_commtg],"%9.3fc")
		local p_tmxcommtg_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_commtg]/_se[treatfull_commtg])))
		
		local est_smcommtg_`x' = string(_b[b_commtg_z_med_d],"%9.3fc")
		local se_smcommtg_`x' = string(_se[b_commtg_z_med_d],"%9.3fc")
		local p_smcommtg_`x' = (2 * ttail(e(df_r), abs(_b[b_commtg_z_med_d]/_se[b_commtg_z_med_d])))
		
		local est_ccommtg_`x' = string(_b[_cons],"%9.3fc")
		local se_ccommtg_`x' = string(_se[_cons],"%9.3fc")
		local p_ccommtg_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bcommtg tmxcommtg smcommtg ccommtg {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
			
		gen sign_commtg_zero_`x' = (`p_commtg_`x''>0.1)
		gen sign_commtg_p1s_`x' = (`p_commtg_`x''<=0.1 & `p_commtg_`x''>0.05 & `est_commtg_`x''>0)
		gen sign_commtg_p2s_`x' = (`p_commtg_`x''<=0.05 & `p_commtg_`x''>0.01 & `est_commtg_`x''>0)
		gen sign_commtg_p3s_`x' = (`p_commtg_`x''<=0.01 & `p_commtg_`x''>=0 & `est_commtg_`x''>0)
		gen sign_commtg_m1s_`x' = (`p_commtg_`x''<=0.1 & `p_commtg_`x''>0.05 & `est_commtg_`x''<0)
		gen sign_commtg_m2s_`x' = (`p_commtg_`x''<=0.05 & `p_commtg_`x''>0.01 & `est_commtg_`x''<0)
		gen sign_commtg_m3s_`x' = (`p_commtg_`x''<=0.01 & `p_commtg_`x''>=0 & `est_commtg_`x''<0)
		
		local p_commtg_`x' = string(`p_commtg_`x'',"%9.3fc")
		local est_commtg_`x' = string(`est_commtg_`x'',"%9.3fc")
		local se_commtg_`x' = string(`se_commtg_`x'',"%9.3fc")
		
		if sign_commtg_p1s_`x' == 1 {
				local sign_commtg_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_commtg_`x' = "`est_commtg_`x''*"
				}
				
		if sign_commtg_p2s_`x' == 1 {	
				local sign_commtg_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_commtg_`x' = "`est_commtg_`x''**"
				}
				
		if sign_commtg_p3s_`x' == 1 {	
				local sign_commtg_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_commtg_`x' = "`est_commtg_`x''***"
				}
			
		if sign_commtg_m1s_`x' == 1 {
				local sign_commtg_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_commtg_`x' = "`est_commtg_`x''*"
				}
				
		if sign_commtg_m2s_`x' == 1 {	
				local sign_commtg_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_commtg_`x' = "`est_commtg_`x''**"
				}
				
		if sign_commtg_m3s_`x' == 1 {	
				local sign_commtg_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_commtg_`x' = "`est_commtg_`x''***"
				}
			
		if sign_commtg_zero_`x' == 1 {
			local sign_commtg_`x' = "0"
			}
		
		drop sign_*
		
		}
	
		
	* Subgroup Effects: Efficacy
		
	* We regress the results
	
	foreach x in `indices_hc' {
	
		areg e_`x' treatfull treatfull_eff b_eff_z_med_d b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_eff
		local n_eff_`x' = string(e(N),"%9.0fc")
		local r2_eff_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_eff
		local est_eff_`x' = r(estimate)
		local se_eff_`x' = r(se)
		test treatfull + treatfull_eff = 0
		local p_eff_`x' = r(p)
		
		local est_beff_`x' = string(_b[treatfull],"%9.3fc")
		local se_beff_`x' = string(_se[treatfull],"%9.3fc")
		local p_beff_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxeff_`x' = string(_b[treatfull_eff],"%9.3fc")
		local se_tmxeff_`x' = string(_se[treatfull_eff],"%9.3fc")
		local p_tmxeff_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_eff]/_se[treatfull_eff])))
		
		local est_smeff_`x' = string(_b[b_eff_z_med_d],"%9.3fc")
		local se_smeff_`x' = string(_se[b_eff_z_med_d],"%9.3fc")
		local p_smeff_`x' = (2 * ttail(e(df_r), abs(_b[b_eff_z_med_d]/_se[b_eff_z_med_d])))
		
		local est_ceff_`x' = string(_b[_cons],"%9.3fc")
		local se_ceff_`x' = string(_se[_cons],"%9.3fc")
		local p_ceff_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in beff tmxeff smeff ceff {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
			
		gen sign_eff_zero_`x' = (`p_eff_`x''>0.1)
		gen sign_eff_p1s_`x' = (`p_eff_`x''<=0.1 & `p_eff_`x''>0.05 & `est_eff_`x''>0)
		gen sign_eff_p2s_`x' = (`p_eff_`x''<=0.05 & `p_eff_`x''>0.01 & `est_eff_`x''>0)
		gen sign_eff_p3s_`x' = (`p_eff_`x''<=0.01 & `p_eff_`x''>=0 & `est_eff_`x''>0)
		gen sign_eff_m1s_`x' = (`p_eff_`x''<=0.1 & `p_eff_`x''>0.05 & `est_eff_`x''<0)
		gen sign_eff_m2s_`x' = (`p_eff_`x''<=0.05 & `p_eff_`x''>0.01 & `est_eff_`x''<0)
		gen sign_eff_m3s_`x' = (`p_eff_`x''<=0.01 & `p_eff_`x''>=0 & `est_eff_`x''<0)
		
		local p_eff_`x' = string(`p_eff_`x'',"%9.3fc")
		local est_eff_`x' = string(`est_eff_`x'',"%9.3fc")
		local se_eff_`x' = string(`se_eff_`x'',"%9.3fc")
		
		if sign_eff_p1s_`x' == 1 {
				local sign_eff_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_eff_`x' = "`est_eff_`x''*"
				}
				
		if sign_eff_p2s_`x' == 1 {	
				local sign_eff_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_eff_`x' = "`est_eff_`x''**"
				}
				
		if sign_eff_p3s_`x' == 1 {	
				local sign_eff_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_eff_`x' = "`est_eff_`x''***"
				}
			
		if sign_eff_m1s_`x' == 1 {
				local sign_eff_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_eff_`x' = "`est_eff_`x''*"
				}
				
		if sign_eff_m2s_`x' == 1 {	
				local sign_eff_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_eff_`x' = "`est_eff_`x''**"
				}
				
		if sign_eff_m3s_`x' == 1 {	
				local sign_eff_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_eff_`x' = "`est_eff_`x''***"
				}
			
		if sign_eff_zero_`x' == 1 {
			local sign_eff_`x' = "0"
			}
		
		drop sign_*
		
		}
		
	* Subgroup Effects: Distance to HC
	
	* We local the vector of control without HC level components
	
	local e_controls_noprefix b_visited_d educyr b_assetindex
		
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_hc
		
		local `x'controls_tfull
		local `x'controls_tfull_hc
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
		
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			
			}
		}
				
	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		
		local e_controls_hc `e_controls_hc' c_hc_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
		
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			
			}
		}
	
	* We regress the results
	
	foreach x in `indices_hc' {
	
		areg e_`x' treatfull treatfull_distance b_distance_hc_z_med_d b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_distance
		local n_distance_`x' = string(e(N),"%9.0fc")
		local r2_distance_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_distance
		local est_distance_`x' = r(estimate)
		local se_distance_`x' = r(se)
		test treatfull + treatfull_distance = 0
		local p_distance_`x' = r(p)
		
		local est_bdistance_`x' = string(_b[treatfull],"%9.3fc")
		local se_bdistance_`x' = string(_se[treatfull],"%9.3fc")
		local p_bdistance_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxdist_`x' = string(_b[treatfull_distance],"%9.3fc")
		local se_tmxdist_`x' = string(_se[treatfull_distance],"%9.3fc")
		local p_tmxdist_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_distance]/_se[treatfull_distance])))
		
		local est_smdist_`x' = string(_b[b_distance_hc_z_med_d],"%9.3fc")
		local se_smdist_`x' = string(_se[b_distance_hc_z_med_d],"%9.3fc")
		local p_smdist_`x' = (2 * ttail(e(df_r), abs(_b[b_distance_hc_z_med_d]/_se[b_distance_hc_z_med_d])))
		
		local est_cdist_`x' = string(_b[_cons],"%9.3fc")
		local se_cdist_`x' = string(_se[_cons],"%9.3fc")
		local p_cdist_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bdistance tmxdist smdist cdist {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
			
		gen sign_distance_zero_`x' = (`p_distance_`x''>0.1)
		gen sign_distance_p1s_`x' = (`p_distance_`x''<=0.1 & `p_distance_`x''>0.05 & `est_distance_`x''>0)
		gen sign_distance_p2s_`x' = (`p_distance_`x''<=0.05 & `p_distance_`x''>0.01 & `est_distance_`x''>0)
		gen sign_distance_p3s_`x' = (`p_distance_`x''<=0.01 & `p_distance_`x''>=0 & `est_distance_`x''>0)
		gen sign_distance_m1s_`x' = (`p_distance_`x''<=0.1 & `p_distance_`x''>0.05 & `est_distance_`x''<0)
		gen sign_distance_m2s_`x' = (`p_distance_`x''<=0.05 & `p_distance_`x''>0.01 & `est_distance_`x''<0)
		gen sign_distance_m3s_`x' = (`p_distance_`x''<=0.01 & `p_distance_`x''>=0 & `est_distance_`x''<0)
		
		local p_distance_`x' = string(`p_distance_`x'',"%9.3fc")
		local est_distance_`x' = string(`est_distance_`x'',"%9.3fc")
		local se_distance_`x' = string(`se_distance_`x'',"%9.3fc")
		
		if sign_distance_p1s_`x' == 1 {
				local sign_distance_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_distance_`x' = "`est_distance_`x''*"
				}
				
		if sign_distance_p2s_`x' == 1 {	
				local sign_distance_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_distance_`x' = "`est_distance_`x''**"
				}
				
		if sign_distance_p3s_`x' == 1 {	
				local sign_distance_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_distance_`x' = "`est_distance_`x''***"
				}
			
		if sign_distance_m1s_`x' == 1 {
				local sign_distance_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_distance_`x' = "`est_distance_`x''*"
				}
				
		if sign_distance_m2s_`x' == 1 {	
				local sign_distance_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_distance_`x' = "`est_distance_`x''**"
				}
				
		if sign_distance_m3s_`x' == 1 {	
				local sign_distance_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_distance_`x' = "`est_distance_`x''***"
				}
			
		if sign_distance_zero_`x' == 1 {
			local sign_distance_`x' = "0"
			}
		
		drop sign_*
		
		}

	
	* Subgroup Effects: Urban Area
	
	foreach x in `indices_hc' {
	
		areg e_`x' treatfull treatfull_urbanarea b_h_urb_area b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_urbanarea
		local n_urbanarea_`x' = string(e(N),"%9.0fc")
		local r2_urbanarea_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_urbanarea
		local est_urbanarea_`x' = r(estimate)
		local se_urbanarea_`x' = r(se)
		test treatfull + treatfull_urbanarea = 0
		local p_urbanarea_`x' = r(p)
		
		local est_ruralarea_`x' = string(_b[treatfull],"%9.3fc")
		local se_ruralarea_`x' = string(_se[treatfull],"%9.3fc")
		local p_ruralarea_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxrural_`x' = string(_b[treatfull_urbanarea],"%9.3fc")
		local se_tmxrural_`x' = string(_se[treatfull_urbanarea],"%9.3fc")
		local p_tmxrural_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_urbanarea]/_se[treatfull_urbanarea])))
			
		local est_smrural_`x' = string(_b[b_h_urb_area],"%9.3fc")
		local se_smrural_`x' = string(_se[b_h_urb_area],"%9.3fc")
		local p_smrural_`x' = (2 * ttail(e(df_r), abs(_b[b_h_urb_area]/_se[b_h_urb_area])))
		
		local est_crural_`x' = string(_b[_cons],"%9.3fc")
		local se_crural_`x' = string(_se[_cons],"%9.3fc")
		local p_crural_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in ruralarea tmxrural smrural crural {
			
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
		
		gen sign_urbanarea_zero_`x' = (`p_urbanarea_`x''>0.1)
		gen sign_urbanarea_p1s_`x' = (`p_urbanarea_`x''<=0.1 & `p_urbanarea_`x''>0.05 & `est_urbanarea_`x''>0)
		gen sign_urbanarea_p2s_`x' = (`p_urbanarea_`x''<=0.05 & `p_urbanarea_`x''>0.01 & `est_urbanarea_`x''>0)
		gen sign_urbanarea_p3s_`x' = (`p_urbanarea_`x''<=0.01 & `p_urbanarea_`x''>=0 & `est_urbanarea_`x''>0)
		gen sign_urbanarea_m1s_`x' = (`p_urbanarea_`x''<=0.1 & `p_urbanarea_`x''>0.05 & `est_urbanarea_`x''<0)
		gen sign_urbanarea_m2s_`x' = (`p_urbanarea_`x''<=0.05 & `p_urbanarea_`x''>0.01 & `est_urbanarea_`x''<0)
		gen sign_urbanarea_m3s_`x' = (`p_urbanarea_`x''<=0.01 & `p_urbanarea_`x''>=0 & `est_urbanarea_`x''<0)
		
		local p_urbanarea_`x' = string(`p_urbanarea_`x'',"%9.3fc")
		local est_urbanarea_`x' = string(`est_urbanarea_`x'',"%9.3fc")
		local se_urbanarea_`x' = string(`se_urbanarea_`x'',"%9.3fc")
		
		if sign_urbanarea_p1s_`x' == 1 {
				local sign_urbanarea_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_urbanarea_`x' = "`est_urbanarea_`x''*"
				}
				
		if sign_urbanarea_p2s_`x' == 1 {	
				local sign_urbanarea_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_urbanarea_`x' = "`est_urbanarea_`x''**"
				}
				
		if sign_urbanarea_p3s_`x' == 1 {	
				local sign_urbanarea_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_urbanarea_`x' = "`est_urbanarea_`x''***"
				}
			
		if sign_urbanarea_m1s_`x' == 1 {
				local sign_urbanarea_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_urbanarea_`x' = "`est_urbanarea_`x''*"
				}
				
		if sign_urbanarea_m2s_`x' == 1 {	
				local sign_urbanarea_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_urbanarea_`x' = "`est_urbanarea_`x''**"
				}
				
		if sign_urbanarea_m3s_`x' == 1 {	
				local sign_urbanarea_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_urbanarea_`x' = "`est_urbanarea_`x''***"
				}
			
		if sign_urbanarea_zero_`x' == 1 {
			local sign_urbanarea_`x' = "0"
			}
		
		drop sign_*
		
		}
	
	* Subgroup Effects: Presence of NGO
	
	foreach x in `indices_hc ' {
	
		areg e_`x' treatfull treatfull_ngo_hc b_ngo_hc b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_ngo
		local n_ngo_`x' = string(e(N),"%9.0fc")
		local r2_ngo_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_ngo_hc
		local est_ngo_`x' = r(estimate)
		local se_ngo_`x' = r(se)
		test treatfull + treatfull_ngo_hc = 0
		local p_ngo_`x' = r(p)
		
		local est_bngo_`x' = string(_b[treatfull],"%9.3fc")
		local se_bngo_`x' = string(_se[treatfull],"%9.3fc")
		local p_bngo_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxngo_`x' = string(_b[treatfull_ngo_hc],"%9.3fc")
		local se_tmxngo_`x' = string(_se[treatfull_ngo_hc],"%9.3fc")
		local p_tmxngo_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_ngo_hc]/_se[treatfull_ngo_hc])))
		
		local est_smngo_`x' = string(_b[b_ngo_hc],"%9.3fc")
		local se_smngo_`x' = string(_se[b_ngo_hc],"%9.3fc")
		local p_smngo_`x' = (2 * ttail(e(df_r), abs(_b[b_ngo_hc]/_se[b_ngo_hc])))
		
		local est_cngo_`x' = string(_b[_cons],"%9.3fc")
		local se_cngo_`x' = string(_se[_cons],"%9.3fc")
		local p_cngo_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bngo tmxngo smngo cngo {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
			
		gen sign_ngo_zero_`x' = (`p_ngo_`x''>0.1)
		gen sign_ngo_p1s_`x' = (`p_ngo_`x''<=0.1 & `p_ngo_`x''>0.05 & `est_ngo_`x''>0)
		gen sign_ngo_p2s_`x' = (`p_ngo_`x''<=0.05 & `p_ngo_`x''>0.01 & `est_ngo_`x''>0)
		gen sign_ngo_p3s_`x' = (`p_ngo_`x''<=0.01 & `p_ngo_`x''>=0 & `est_ngo_`x''>0)
		gen sign_ngo_m1s_`x' = (`p_ngo_`x''<=0.1 & `p_ngo_`x''>0.05 & `est_ngo_`x''<0)
		gen sign_ngo_m2s_`x' = (`p_ngo_`x''<=0.05 & `p_ngo_`x''>0.01 & `est_ngo_`x''<0)
		gen sign_ngo_m3s_`x' = (`p_ngo_`x''<=0.01 & `p_ngo_`x''>=0 & `est_ngo_`x''<0)
		
		local p_ngo_`x' = string(`p_ngo_`x'',"%9.3fc")
		local est_ngo_`x' = string(`est_ngo_`x'',"%9.3fc")
		local se_ngo_`x' = string(`se_ngo_`x'',"%9.3fc")
		
		if sign_ngo_p1s_`x' == 1 {
				local sign_ngo_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_ngo_`x' = "`est_ngo_`x''*"
				}
				
		if sign_ngo_p2s_`x' == 1 {	
				local sign_ngo_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_ngo_`x' = "`est_ngo_`x''**"
				}
				
		if sign_ngo_p3s_`x' == 1 {	
				local sign_ngo_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_ngo_`x' = "`est_ngo_`x''***"
				}
			
		if sign_ngo_m1s_`x' == 1 {
				local sign_ngo_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_ngo_`x' = "`est_ngo_`x''*"
				}
				
		if sign_ngo_m2s_`x' == 1 {	
				local sign_ngo_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_ngo_`x' = "`est_ngo_`x''**"
				}
				
		if sign_ngo_m3s_`x' == 1 {	
				local sign_ngo_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_ngo_`x' = "`est_ngo_`x''***"
				}
			
		if sign_ngo_zero_`x' == 1 {
			local sign_ngo_`x' = "0"
			}
			
		drop sign_*

		}
	
	* Subgroup Effects: Baseline U5M
	
	foreach x in `indices_hc' {

		areg e_`x' treatfull treatfull_u5m_hc b_h_u5mortality_med_d b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_u5m
		local n_u5m_`x' = string(e(N),"%9.0fc")
		local r2_u5m_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_u5m_hc
		local est_u5m_`x' = r(estimate)
		local se_u5m_`x' = r(se)
		test treatfull + treatfull_u5m_hc = 0
		local p_u5m_`x' = r(p)
		
		local est_bu5m_`x' = string(_b[treatfull],"%9.3fc")
		local se_bu5m_`x' = string(_se[treatfull],"%9.3fc")
		local p_bu5m_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxu5m_`x' = string(_b[treatfull_u5m_hc],"%9.3fc")
		local se_tmxu5m_`x' = string(_se[treatfull_u5m_hc],"%9.3fc")
		local p_tmxu5m_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_u5m_hc]/_se[treatfull_u5m_hc])))
		
		local est_smu5m_`x' = string(_b[b_h_u5mortality_med_d],"%9.3fc")
		local se_smu5m_`x' = string(_se[b_h_u5mortality_med_d],"%9.3fc")
		local p_smu5m_`x' = (2 * ttail(e(df_r), abs(_b[b_h_u5mortality_med_d]/_se[b_h_u5mortality_med_d])))
		
		local est_cu5m_`x' = string(_b[_cons],"%9.3fc")
		local se_cu5m_`x' = string(_se[_cons],"%9.3fc")
		local p_cu5m_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bu5m tmxu5m smu5m cu5m {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
			
		gen sign_u5m_zero_`x' = (`p_u5m_`x''>0.1)
		gen sign_u5m_p1s_`x' = (`p_u5m_`x''<=0.1 & `p_u5m_`x''>0.05 & `est_u5m_`x''>0)
		gen sign_u5m_p2s_`x' = (`p_u5m_`x''<=0.05 & `p_u5m_`x''>0.01 & `est_u5m_`x''>0)
		gen sign_u5m_p3s_`x' = (`p_u5m_`x''<=0.01 & `p_u5m_`x''>=0 & `est_u5m_`x''>0)
		gen sign_u5m_m1s_`x' = (`p_u5m_`x''<=0.1 & `p_u5m_`x''>0.05 & `est_u5m_`x''<0)
		gen sign_u5m_m2s_`x' = (`p_u5m_`x''<=0.05 & `p_u5m_`x''>0.01 & `est_u5m_`x''<0)
		gen sign_u5m_m3s_`x' = (`p_u5m_`x''<=0.01 & `p_u5m_`x''>=0 & `est_u5m_`x''<0)
		
		local p_u5m_`x' = string(`p_u5m_`x'',"%9.3fc")
		local est_u5m_`x' = string(`est_u5m_`x'',"%9.3fc")
		local se_u5m_`x' = string(`se_u5m_`x'',"%9.3fc")
		
		if sign_u5m_p1s_`x' == 1 {
				local sign_u5m_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_u5m_`x' = "`est_u5m_`x''*"
				}
				
		if sign_u5m_p2s_`x' == 1 {	
				local sign_u5m_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_u5m_`x' = "`est_u5m_`x''**"
				}
				
		if sign_u5m_p3s_`x' == 1 {	
				local sign_u5m_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_u5m_`x' = "`est_u5m_`x''***"
				}
			
		if sign_u5m_m1s_`x' == 1 {
				local sign_u5m_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_u5m_`x' = "`est_u5m_`x''*"
				}
				
		if sign_u5m_m2s_`x' == 1 {	
				local sign_u5m_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_u5m_`x' = "`est_u5m_`x''**"
				}
				
		if sign_u5m_m3s_`x' == 1 {	
				local sign_u5m_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_u5m_`x' = "`est_u5m_`x''***"
				}
			
		if sign_u5m_zero_`x' == 1 {
			local sign_u5m_`x' = "0"
			}
			
		drop sign_*

		}
		
	**************************
	* Household and HC level *
	**************************
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	ren e_h_ctzpressure_z e_h_ctzpre_z
	ren b_h_ctzpressure_z b_h_ctzpre_z
	
	ren b_h_ctzpressure_z_d b_h_ctzpre_z_d
	
	
	* We merge the different indices
	
	merge m:1 hc_id using "`bu5m'"
	
	* We will create the interaction terms
	
	foreach var in u5_p2p {
	
		gen treatfull_`var' = treatfull * `var'
		la var treatfull_`var' "treatfull * `var'"
		
		}
		
	
	* We now run the subgroup analysis for the P2P 1 SD components
	
	* Subgroup Effects: Baseline U5M 1 SD P2P
	
	foreach x in `indices' {
		areg e_`x' treatfull treatfull_u5_p2p u5_p2p b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		eststo e_`x'_u5mp2p
		local n_u5mp2p_`x' = string(e(N),"%9.0fc")
		local r2_u5mp2p_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_u5_p2p
		local est_u5mp2p_`x' = r(estimate)
		local se_u5mp2p_`x' = r(se)
		test treatfull + treatfull_u5_p2p = 0
		local p_u5mp2p_`x' = r(p)
		
		local est_bu5mp2p_`x' = string(_b[treatfull],"%9.3fc")
		local se_bu5mp2p_`x' = string(_se[treatfull],"%9.3fc")
		local p_bu5mp2p_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxu5mp2p_`x' = string(_b[treatfull_u5_p2p],"%9.3fc")
		local se_tmxu5mp2p_`x' = string(_se[treatfull_u5_p2p],"%9.3fc")
		local p_tmxu5mp2p_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_u5_p2p]/_se[treatfull_u5_p2p])))
		
		local est_smu5mp2p_`x' = string(_b[u5_p2p],"%9.3fc")
		local se_smu5mp2p_`x' = string(_se[u5_p2p],"%9.3fc")
		local p_smu5mp2p_`x' = (2 * ttail(e(df_r), abs(_b[u5_p2p]/_se[u5_p2p])))
		
		local est_cu5mp2p_`x' = string(_b[_cons],"%9.3fc")
		local se_cu5mp2p_`x' = string(_se[_cons],"%9.3fc")
		local p_cu5mp2p_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bu5mp2p tmxu5mp2p smu5mp2p cu5mp2p {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
			
		gen sign_u5mp2p_zero_`x' = (`p_u5mp2p_`x''>0.1)
		gen sign_u5mp2p_p1s_`x' = (`p_u5mp2p_`x''<=0.1 & `p_u5mp2p_`x''>0.05 & `est_u5mp2p_`x''>0)
		gen sign_u5mp2p_p2s_`x' = (`p_u5mp2p_`x''<=0.05 & `p_u5mp2p_`x''>0.01 & `est_u5mp2p_`x''>0)
		gen sign_u5mp2p_p3s_`x' = (`p_u5mp2p_`x''<=0.01 & `p_u5mp2p_`x''>=0 & `est_u5mp2p_`x''>0)
		gen sign_u5mp2p_m1s_`x' = (`p_u5mp2p_`x''<=0.1 & `p_u5mp2p_`x''>0.05 & `est_u5mp2p_`x''<0)
		gen sign_u5mp2p_m2s_`x' = (`p_u5mp2p_`x''<=0.05 & `p_u5mp2p_`x''>0.01 & `est_u5mp2p_`x''<0)
		gen sign_u5mp2p_m3s_`x' = (`p_u5mp2p_`x''<=0.01 & `p_u5mp2p_`x''>=0 & `est_u5mp2p_`x''<0)
		
		local p_u5mp2p_`x' = string(`p_u5mp2p_`x'',"%9.3fc")
		local est_u5mp2p_`x' = string(`est_u5mp2p_`x'',"%9.3fc")
		local se_u5mp2p_`x' = string(`se_u5mp2p_`x'',"%9.3fc")
		
		if sign_u5mp2p_p1s_`x' == 1 {
				local sign_u5mp2p_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_u5mp2p_`x' = "`est_u5mp2p_`x''*"
				}
				
		if sign_u5mp2p_p2s_`x' == 1 {	
				local sign_u5mp2p_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_u5mp2p_`x' = "`est_u5mp2p_`x''**"
				}
				
		if sign_u5mp2p_p3s_`x' == 1 {	
				local sign_u5mp2p_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_u5mp2p_`x' = "`est_u5mp2p_`x''***"
				}
			
		if sign_u5mp2p_m1s_`x' == 1 {
				local sign_u5mp2p_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_u5mp2p_`x' = "`est_u5mp2p_`x''*"
				}
				
		if sign_u5mp2p_m2s_`x' == 1 {	
				local sign_u5mp2p_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_u5mp2p_`x' = "`est_u5mp2p_`x''**"
				}
				
		if sign_u5mp2p_m3s_`x' == 1 {	
				local sign_u5mp2p_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_u5mp2p_`x' = "`est_u5mp2p_`x''***"
				}
			
		if sign_u5mp2p_zero_`x' == 1 {
			local sign_u5mp2p_`x' = "0"
			}
			
		drop sign_*

		}
	
	foreach x in `indices_hc' {
		areg e_`x' treatfull treatfull_u5_p2p u5_p2p b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_u5mp2p
		local n_u5mp2p_`x' = string(e(N),"%9.0fc")
		local r2_u5mp2p_`x' = string(e(r2),"%9.3fc")
		
		lincom treatfull + treatfull_u5_p2p
		local est_u5mp2p_`x' = r(estimate)
		local se_u5mp2p_`x' = r(se)
		test treatfull + treatfull_u5_p2p = 0
		local p_u5mp2p_`x' = r(p)
		
		local est_bu5mp2p_`x' = string(_b[treatfull],"%9.3fc")
		local se_bu5mp2p_`x' = string(_se[treatfull],"%9.3fc")
		local p_bu5mp2p_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxu5mp2p_`x' = string(_b[treatfull_u5_p2p],"%9.3fc")
		local se_tmxu5mp2p_`x' = string(_se[treatfull_u5_p2p],"%9.3fc")
		local p_tmxu5mp2p_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_u5_p2p]/_se[treatfull_u5_p2p])))
		
		local est_smu5mp2p_`x' = string(_b[u5_p2p],"%9.3fc")
		local se_smu5mp2p_`x' = string(_se[u5_p2p],"%9.3fc")
		local p_smu5mp2p_`x' = (2 * ttail(e(df_r), abs(_b[u5_p2p]/_se[u5_p2p])))
		
		local est_cu5mp2p_`x' = string(_b[_cons],"%9.3fc")
		local se_cu5mp2p_`x' = string(_se[_cons],"%9.3fc")
		local p_cu5mp2p_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bu5mp2p tmxu5mp2p smu5mp2p cu5mp2p {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			
			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
			
		gen sign_u5mp2p_zero_`x' = (`p_u5mp2p_`x''>0.1)
		gen sign_u5mp2p_p1s_`x' = (`p_u5mp2p_`x''<=0.1 & `p_u5mp2p_`x''>0.05 & `est_u5mp2p_`x''>0)
		gen sign_u5mp2p_p2s_`x' = (`p_u5mp2p_`x''<=0.05 & `p_u5mp2p_`x''>0.01 & `est_u5mp2p_`x''>0)
		gen sign_u5mp2p_p3s_`x' = (`p_u5mp2p_`x''<=0.01 & `p_u5mp2p_`x''>=0 & `est_u5mp2p_`x''>0)
		gen sign_u5mp2p_m1s_`x' = (`p_u5mp2p_`x''<=0.1 & `p_u5mp2p_`x''>0.05 & `est_u5mp2p_`x''<0)
		gen sign_u5mp2p_m2s_`x' = (`p_u5mp2p_`x''<=0.05 & `p_u5mp2p_`x''>0.01 & `est_u5mp2p_`x''<0)
		gen sign_u5mp2p_m3s_`x' = (`p_u5mp2p_`x''<=0.01 & `p_u5mp2p_`x''>=0 & `est_u5mp2p_`x''<0)
		
		local p_u5mp2p_`x' = string(`p_u5mp2p_`x'',"%9.3fc")
		local est_u5mp2p_`x' = string(`est_u5mp2p_`x'',"%9.3fc")
		local se_u5mp2p_`x' = string(`se_u5mp2p_`x'',"%9.3fc")
		
		if sign_u5mp2p_p1s_`x' == 1 {
				local sign_u5mp2p_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_u5mp2p_`x' = "`est_u5mp2p_`x''*"
				}
				
		if sign_u5mp2p_p2s_`x' == 1 {	
				local sign_u5mp2p_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_u5mp2p_`x' = "`est_u5mp2p_`x''**"
				}
				
		if sign_u5mp2p_p3s_`x' == 1 {	
				local sign_u5mp2p_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_u5mp2p_`x' = "`est_u5mp2p_`x''***"
				}
			
		if sign_u5mp2p_m1s_`x' == 1 {
				local sign_u5mp2p_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_u5mp2p_`x' = "`est_u5mp2p_`x''*"
				}
				
		if sign_u5mp2p_m2s_`x' == 1 {	
				local sign_u5mp2p_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_u5mp2p_`x' = "`est_u5mp2p_`x''**"
				}
				
		if sign_u5mp2p_m3s_`x' == 1 {	
				local sign_u5mp2p_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_u5mp2p_`x' = "`est_u5mp2p_`x''***"
				}
			
		if sign_u5mp2p_zero_`x' == 1 {
			local sign_u5mp2p_`x' = "0"
			}
			
		drop sign_*

		}
		
	********************
	* Individual level *
	********************
	
	* Health outcome
	
	* At endline
	
	use "${usedata}/healthoutcome_endline_ind.dta", clear
	
	***************
	* Regressions *
	***************

	**********************************************************
	** Controlvar corresponds to the main control variables **
	**********************************************************
	
	* We regress the results
	
	* We rename for length of variable reason
	
	ren e_healthoutcome_z e_healthout_z
	ren b_healthoutcome_z b_healthout_z
	ren b_healthoutcome_z_d b_healthout_z_d
		
	* Regressions at endline 
	
	* We local the vector of controls without HC level components
	
	local  e_controls_noprefix b_visited_d educyr b_assetindex
		
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_hc
		
		local `x'controls_tfull
		local `x'controls_tfull_hc
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
		
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			
			}
		}
				
	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		
		local e_controls_hc `e_controls_hc' c_hc_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
		
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			
			}
		}
		
	* We recode the variable to study backwardness
	
	foreach var in b_treatqual_z_med_d b_h_urb_area b_h_outsideoption_z_med_d b_ngo_hc {
	
		recode `var' (0=1) (1=0)
		
		}
		
	replace treatfull_treatqual = treatfull * b_treatqual_z_med_d
	replace treatfull_outsideoption = treatfull * b_h_outsideoption_z_med_d 
	replace treatfull_urbanarea = treatfull * b_h_urb_area
	replace treatfull_ngo_hc = treatfull * b_ngo_hc
	
		
	* We regress the results
	
	* Subgroup effects: HC2

	local x healthout_z

	areg e_`x' treatfull treatfull_hc2 hc2 b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		
	eststo e_`x'_hc2
	local n_hc3_`x' = string(e(N),"%9.0fc")
	local r2_hc3_`x' = string(e(r2),"%9.3fc")

	lincom treatfull + treatfull_hc2 
	local est_hc2_`x' = r(estimate)
	local se_hc2_`x' = r(se)
	test treatfull + treatfull_hc2 = 0
	local p_hc2_`x' = r(p)
	
	local est_hc3_`x' = string(_b[treatfull],"%9.3fc")
	local se_hc3_`x' = string(_se[treatfull],"%9.3fc")
	local p_hc3_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
	
	local est_tmxhc3_`x' = string(_b[treatfull_hc2],"%9.3fc")
	local se_tmxhc3_`x' = string(_se[treatfull_hc2],"%9.3fc")
	local p_tmxhc3_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_hc2]/_se[treatfull_hc2])))
	
	local est_smhc3_`x' = string(_b[hc2],"%9.3fc")
	local se_smhc3_`x' = string(_se[hc2],"%9.3fc")
	local p_smhc3_`x' = (2 * ttail(e(df_r), abs(_b[hc2]/_se[hc2])))
	
	local est_chc3_`x' = string(_b[_cons],"%9.3fc")
	local se_chc3_`x' = string(_se[_cons],"%9.3fc")
	local p_chc3_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
	
	foreach var in hc3 tmxhc3 smhc3 chc3 {
	
		gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
		gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
		gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
		gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
		gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
		gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
		gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
		

		if sign_`var'_p1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_p2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_p3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_m1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_m2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_m3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_zero_`x' == 1 {
			local sign_`var'_`x' = "0"
			}
			
		}
	
	gen sign_hc2_zero_`x' = (`p_hc2_`x''>0.1)
	gen sign_hc2_p1s_`x' = (`p_hc2_`x''<=0.1 & `p_hc2_`x''>0.05 & `est_hc2_`x''>0)
	gen sign_hc2_p2s_`x' = (`p_hc2_`x''<=0.05 & `p_hc2_`x''>0.01 & `est_hc2_`x''>0)
	gen sign_hc2_p3s_`x' = (`p_hc2_`x''<=0.01 & `p_hc2_`x''>=0 & `est_hc2_`x''>0)
	gen sign_hc2_m1s_`x' = (`p_hc2_`x''<=0.1 & `p_hc2_`x''>0.05 & `est_hc2_`x''<0)
	gen sign_hc2_m2s_`x' = (`p_hc2_`x''<=0.05 & `p_hc2_`x''>0.01 & `est_hc2_`x''<0)
	gen sign_hc2_m3s_`x' = (`p_hc2_`x''<=0.01 & `p_hc2_`x''>=0 & `est_hc2_`x''<0)
	
	local p_hc2_`x' = string(`p_hc2_`x'',"%9.3fc")
	local est_hc2_`x' = string(`est_hc2_`x'',"%9.3fc")
	local se_hc2_`x' = string(`se_hc2_`x'',"%9.3fc")
	
	if sign_hc2_p1s_`x' == 1 {
			local sign_hc2_`x' = "\cellcolor[HTML]{EFEFEF}+"
			local est_hc2_`x' = "`est_hc2_`x''*"
			}
			
	if sign_hc2_p2s_`x' == 1 {	
			local sign_hc2_`x' = "\cellcolor[HTML]{C0C0C0}+"
			local est_hc2_`x' = "`est_hc2_`x''**"
			}
			
	if sign_hc2_p3s_`x' == 1 {	
			local sign_hc2_`x' = "\cellcolor[HTML]{9B9B9B}+"
			local est_hc2_`x' = "`est_hc2_`x''***"
			}
		
	if sign_hc2_m1s_`x' == 1 {
			local sign_hc2_`x' = "\cellcolor[HTML]{EFEFEF}-"
			local est_hc2_`x' = "`est_hc2_`x''*"
			}
			
	if sign_hc2_m2s_`x' == 1 {	
			local sign_hc2_`x' = "\cellcolor[HTML]{C0C0C0}-"
			local est_hc2_`x' = "`est_hc2_`x''**"
			}
			
	if sign_hc2_m3s_`x' == 1 {	
			local sign_hc2_`x' = "\cellcolor[HTML]{9B9B9B}-"
			local est_hc2_`x' = "`est_hc2_`x''***"
			}
		
	if sign_hc2_zero_`x' == 1 {
		local sign_hc2_`x' = "0"
		}
	
	drop sign_*
	
	* Subgroup effects: Treatment Quality
	
	* We local the vector of controls with HC level components
	
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_hc
		
		local `x'controls_tfull
		local `x'controls_tfull_hc
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
		
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			
			}
		}
				
	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		
		local e_controls_hc `e_controls_hc' c_hc_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
		
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			
			}
		}
	
	* We regress the results
	
	local x healthout_z

	areg e_`x' treatfull treatfull_treatqual b_treatqual_z_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
	
	eststo e_`x'_treatqual
	local n_treatqual_`x' = string(e(N),"%9.0fc")
	local r2_treatqual_`x' = string(e(r2),"%9.3fc")
	
	lincom treatfull + treatfull_treatqual
	local est_treatqual_`x' = r(estimate)
	local se_treatqual_`x' = r(se)
	test treatfull + treatfull_treatqual = 0
	local p_treatqual_`x' = r(p)
	
	local est_btreatqual_`x' = string(_b[treatfull],"%9.3fc")
	local se_btreatqual_`x' = string(_se[treatfull],"%9.3fc")
	local p_btreatqual_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
	
	local est_tmxtqual_`x' = string(_b[treatfull_treatqual],"%9.3fc")
	local se_tmxtqual_`x' = string(_se[treatfull_treatqual],"%9.3fc")
	local p_tmxtqual_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_treatqual]/_se[treatfull_treatqual])))
	
	local est_smtqual_`x' = string(_b[b_treatqual_z_med_d],"%9.3fc")
	local se_smtqual_`x' = string(_se[b_treatqual_z_med_d],"%9.3fc")
	local p_smtqual_`x' = (2 * ttail(e(df_r), abs(_b[b_treatqual_z_med_d]/_se[b_treatqual_z_med_d])))
	
	local est_ctqual_`x' = string(_b[_cons],"%9.3fc")
	local se_ctqual_`x' = string(_se[_cons],"%9.3fc")
	local p_ctqual_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
	
	foreach var in btreatqual tmxtqual smtqual ctqual {
	
		gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
		gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
		gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
		gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
		gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
		gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
		gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
		
		if sign_`var'_p1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_p2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_p3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_m1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_m2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_m3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_zero_`x' == 1 {
			local sign_`var'_`x' = "0"
			}
			
		}

	
	gen sign_treatqual_zero_`x' = (`p_treatqual_`x''>0.1)
	gen sign_treatqual_p1s_`x' = (`p_treatqual_`x''<=0.1 & `p_treatqual_`x''>0.05 & `est_treatqual_`x''>0)
	gen sign_treatqual_p2s_`x' = (`p_treatqual_`x''<=0.05 & `p_treatqual_`x''>0.01 & `est_treatqual_`x''>0)
	gen sign_treatqual_p3s_`x' = (`p_treatqual_`x''<=0.01 & `p_treatqual_`x''>=0 & `est_treatqual_`x''>0)
	gen sign_treatqual_m1s_`x' = (`p_treatqual_`x''<=0.1 & `p_treatqual_`x''>0.05 & `est_treatqual_`x''<0)
	gen sign_treatqual_m2s_`x' = (`p_treatqual_`x''<=0.05 & `p_treatqual_`x''>0.01 & `est_treatqual_`x''<0)
	gen sign_treatqual_m3s_`x' = (`p_treatqual_`x''<=0.01 & `p_treatqual_`x''>=0 & `est_treatqual_`x''<0)
	
	local p_treatqual_`x' = string(`p_treatqual_`x'',"%9.3fc")
	local est_treatqual_`x' = string(`est_treatqual_`x'',"%9.3fc")
	local se_treatqual_`x' = string(`se_treatqual_`x'',"%9.3fc")
	
	if sign_treatqual_p1s_`x' == 1 {
			local sign_treatqual_`x' = "\cellcolor[HTML]{EFEFEF}+"
			local est_treatqual_`x' = "`est_treatqual_`x''*"
			}
			
	if sign_treatqual_p2s_`x' == 1 {	
			local sign_treatqual_`x' = "\cellcolor[HTML]{C0C0C0}+"
			local est_treatqual_`x' = "`est_treatqual_`x''**"
			}
			
	if sign_treatqual_p3s_`x' == 1 {	
			local sign_treatqual_`x' = "\cellcolor[HTML]{9B9B9B}+"
			local est_treatqual_`x' = "`est_treatqual_`x''***"
			}
		
	if sign_treatqual_m1s_`x' == 1 {
			local sign_treatqual_`x' = "\cellcolor[HTML]{EFEFEF}-"
			local est_treatqual_`x' = "`est_treatqual_`x''*"
			}
			
	if sign_treatqual_m2s_`x' == 1 {	
			local sign_treatqual_`x' = "\cellcolor[HTML]{C0C0C0}-"
			local est_treatqual_`x' = "`est_treatqual_`x''**"
			}
			
	if sign_treatqual_m3s_`x' == 1 {	
			local sign_treatqual_`x' = "\cellcolor[HTML]{9B9B9B}-"
			local est_treatqual_`x' = "`est_treatqual_`x''***"
			}
		
	if sign_treatqual_zero_`x' == 1 {
		local sign_treatqual_`x' = "0"
		}
	
	drop sign_*
		
	* Subgroup Effects: Outside Options
	
	* We local the vector of controls without HC level components
	
	local  e_controls_noprefix b_visited_d educyr b_assetindex
		
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_hc
		
		local `x'controls_tfull
		local `x'controls_tfull_hc
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
		
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			
			}
		}
				
	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		
		local e_controls_hc `e_controls_hc' c_hc_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
		
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			
			}
		}
		
	local x healthout_z

	areg e_`x' treatfull treatfull_outsideoption b_h_outsideoption_z_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		
	eststo e_`x'_outsideoption
	local n_outside_`x' = string(e(N),"%9.0fc")
	local r2_outside_`x' = string(e(r2),"%9.3fc")
	
	lincom treatfull + treatfull_outsideoption
	local est_outside_`x' = r(estimate)
	local se_outside_`x' = r(se)
	test treatfull + treatfull_outsideoption = 0
	local p_outside_`x' = r(p)
	
	local est_boutside_`x' = string(_b[treatfull],"%9.3fc")
	local se_boutside_`x' = string(_se[treatfull],"%9.3fc")
	local p_boutside_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
	
	local est_tmxoutside_`x' = string(_b[treatfull_outsideoption],"%9.3fc")
	local se_tmxoutside_`x' = string(_se[treatfull_outsideoption],"%9.3fc")
	local p_tmxoutside_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_outsideoption]/_se[treatfull_outsideoption])))
	
	local est_smoutside_`x' = string(_b[b_h_outsideoption_z_med_d],"%9.3fc")
	local se_smoutside_`x' = string(_se[b_h_outsideoption_z_med_d],"%9.3fc")
	local p_smoutside_`x' = (2 * ttail(e(df_r), abs(_b[b_h_outsideoption_z_med_d]/_se[b_h_outsideoption_z_med_d])))
	
	local est_coutside_`x' = string(_b[_cons],"%9.3fc")
	local se_coutside_`x' = string(_se[_cons],"%9.3fc")
	local p_coutside_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
	
	foreach var in boutside tmxoutside smoutside coutside {
	
		gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
		gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
		gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
		gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
		gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
		gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
		gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
		
		if sign_`var'_p1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_p2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_p3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_m1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_m2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_m3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_zero_`x' == 1 {
			local sign_`var'_`x' = "0"
			}
			
		}
	
	gen sign_outside_zero_`x' = (`p_outside_`x''>0.1)
	gen sign_outside_p1s_`x' = (`p_outside_`x''<=0.1 & `p_outside_`x''>0.05 & `est_outside_`x''>0)
	gen sign_outside_p2s_`x' = (`p_outside_`x''<=0.05 & `p_outside_`x''>0.01 & `est_outside_`x''>0)
	gen sign_outside_p3s_`x' = (`p_outside_`x''<=0.01 & `p_outside_`x''>=0 & `est_outside_`x''>0)
	gen sign_outside_m1s_`x' = (`p_outside_`x''<=0.1 & `p_outside_`x''>0.05 & `est_outside_`x''<0)
	gen sign_outside_m2s_`x' = (`p_outside_`x''<=0.05 & `p_outside_`x''>0.01 & `est_outside_`x''<0)
	gen sign_outside_m3s_`x' = (`p_outside_`x''<=0.01 & `p_outside_`x''>=0 & `est_outside_`x''<0)
	
	local p_outside_`x' = string(`p_outside_`x'',"%9.3fc")
	local est_outside_`x' = string(`est_outside_`x'',"%9.3fc")
	local se_outside_`x' = string(`se_outside_`x'',"%9.3fc")
	
	if sign_outside_p1s_`x' == 1 {
			local sign_outside_`x' = "\cellcolor[HTML]{EFEFEF}+"
			local est_outside_`x' = "`est_outside_`x''*"
			}
			
	if sign_outside_p2s_`x' == 1 {	
			local sign_outside_`x' = "\cellcolor[HTML]{C0C0C0}+"
			local est_outside_`x' = "`est_outside_`x''**"
			}
			
	if sign_outside_p3s_`x' == 1 {	
			local sign_outside_`x' = "\cellcolor[HTML]{9B9B9B}+"
			local est_outside_`x' = "`est_outside_`x''***"
			}
		
	if sign_outside_m1s_`x' == 1 {
			local sign_outside_`x' = "\cellcolor[HTML]{EFEFEF}-"
			local est_outside_`x' = "`est_outside_`x''*"
			}
			
	if sign_outside_m2s_`x' == 1 {	
			local sign_outside_`x' = "\cellcolor[HTML]{C0C0C0}-"
			local est_outside_`x' = "`est_outside_`x''**"
			}
			
	if sign_outside_m3s_`x' == 1 {	
			local sign_outside_`x' = "\cellcolor[HTML]{9B9B9B}-"
			local est_outside_`x' = "`est_outside_`x''***"
			}
		
	if sign_outside_zero_`x' == 1 {
		local sign_outside_`x' = "0"
		}
	
	drop sign_*
		
		
	* Subgroup Effects: Embededness Index
	
	local x healthout_z
	
	areg e_`x' treatfull treatfull_embededness b_h_embed_index_z_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		
	eststo e_`x'_embededness
	local n_embed_`x' = string(e(N),"%9.0fc")
	local r2_embed_`x' = string(e(r2),"%9.3fc")
	
	lincom treatfull + treatfull_embededness
	local est_embed_`x' = r(estimate)
	local se_embed_`x' = r(se)
	test treatfull + treatfull_embededness = 0
	local p_embed_`x' = r(p)
	
	local est_bembed_`x' = string(_b[treatfull],"%9.3fc")
	local se_bembed_`x' = string(_se[treatfull],"%9.3fc")
	local p_bembed_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
	
	local est_tmxembed_`x' = string(_b[treatfull_embededness],"%9.3fc")
	local se_tmxembed_`x' = string(_se[treatfull_embededness],"%9.3fc")
	local p_tmxembed_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_embededness]/_se[treatfull_embededness])))
	
	local est_smembed_`x' = string(_b[b_h_embed_index_z_med_d],"%9.3fc")
	local se_smembed_`x' = string(_se[b_h_embed_index_z_med_d],"%9.3fc")
	local p_smembed_`x' = (2 * ttail(e(df_r), abs(_b[b_h_embed_index_z_med_d]/_se[b_h_embed_index_z_med_d])))
	
	local est_cembed_`x' = string(_b[_cons],"%9.3fc")
	local se_cembed_`x' = string(_se[_cons],"%9.3fc")
	local p_cembed_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
	
	foreach var in bembed tmxembed smembed cembed {
		
		gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
		gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
		gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
		gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
		gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
		gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
		gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
		
		if sign_`var'_p1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_p2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_p3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_m1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_m2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_m3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_zero_`x' == 1 {
			local sign_`var'_`x' = "0"
			}
			
		}
			
	gen sign_embed_zero_`x' = (`p_embed_`x''>0.1)
	gen sign_embed_p1s_`x' = (`p_embed_`x''<=0.1 & `p_embed_`x''>0.05 & `est_embed_`x''>0)
	gen sign_embed_p2s_`x' = (`p_embed_`x''<=0.05 & `p_embed_`x''>0.01 & `est_embed_`x''>0)
	gen sign_embed_p3s_`x' = (`p_embed_`x''<=0.01 & `p_embed_`x''>=0 & `est_embed_`x''>0)
	gen sign_embed_m1s_`x' = (`p_embed_`x''<=0.1 & `p_embed_`x''>0.05 & `est_embed_`x''<0)
	gen sign_embed_m2s_`x' = (`p_embed_`x''<=0.05 & `p_embed_`x''>0.01 & `est_embed_`x''<0)
	gen sign_embed_m3s_`x' = (`p_embed_`x''<=0.01 & `p_embed_`x''>=0 & `est_embed_`x''<0)
	
	local p_embed_`x' = string(`p_embed_`x'',"%9.3fc")
	local est_embed_`x' = string(`est_embed_`x'',"%9.3fc")
	local se_embed_`x' = string(`se_embed_`x'',"%9.3fc")
	
	if sign_embed_p1s_`x' == 1 {
			local sign_embed_`x' = "\cellcolor[HTML]{EFEFEF}+"
			local est_embed_`x' = "`est_embed_`x''*"
			}
			
	if sign_embed_p2s_`x' == 1 {	
			local sign_embed_`x' = "\cellcolor[HTML]{C0C0C0}+"
			local est_embed_`x' = "`est_embed_`x''**"
			}
			
	if sign_embed_p3s_`x' == 1 {	
			local sign_embed_`x' = "\cellcolor[HTML]{9B9B9B}+"
			local est_embed_`x' = "`est_embed_`x''***"
			}
		
	if sign_embed_m1s_`x' == 1 {
			local sign_embed_`x' = "\cellcolor[HTML]{EFEFEF}-"
			local est_embed_`x' = "`est_embed_`x''*"
			}
			
	if sign_embed_m2s_`x' == 1 {	
			local sign_embed_`x' = "\cellcolor[HTML]{C0C0C0}-"
			local est_embed_`x' = "`est_embed_`x''**"
			}
			
	if sign_embed_m3s_`x' == 1 {	
			local sign_embed_`x' = "\cellcolor[HTML]{9B9B9B}-"
			local est_embed_`x' = "`est_embed_`x''***"
			}
		
	if sign_embed_zero_`x' == 1 {
		local sign_embed_`x' = "0"
		}
	
	drop sign_*
		
	* Subgroup Effects: Collective Action Potential
	
	local x healthout_z

	areg e_`x' treatfull treatfull_capotential b_capotential_z_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		
	eststo e_`x'_cap
	local n_cap_`x' = string(e(N),"%9.0fc")
	local r2_cap_`x' = string(e(r2),"%9.3fc")
	
	lincom treatfull + treatfull_capotential
	local est_cap_`x' = r(estimate)
	local se_cap_`x' = r(se)
	test treatfull + treatfull_capotential = 0
	local p_cap_`x' = r(p)
	
	local est_bcap_`x' = string(_b[treatfull],"%9.3fc")
	local se_bcap_`x' = string(_se[treatfull],"%9.3fc")
	local p_bcap_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
	
	local est_tmxcap_`x' = string(_b[treatfull_capotential],"%9.3fc")
	local se_tmxcap_`x' = string(_se[treatfull_capotential],"%9.3fc")
	local p_tmxcap_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_capotential]/_se[treatfull_capotential])))
	
	local est_smcap_`x' = string(_b[b_capotential_z_med_d],"%9.3fc")
	local se_smcap_`x' = string(_se[b_capotential_z_med_d],"%9.3fc")
	local p_smcap_`x' = (2 * ttail(e(df_r), abs(_b[b_capotential_z_med_d]/_se[b_capotential_z_med_d])))
	
	local est_ccap_`x' = string(_b[_cons],"%9.3fc")
	local se_ccap_`x' = string(_se[_cons],"%9.3fc")
	local p_ccap_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
	
	foreach var in bcap tmxcap smcap ccap {
	
		gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
		gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
		gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
		gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
		gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
		gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
		gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
		
		if sign_`var'_p1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_p2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_p3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_m1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_m2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_m3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_zero_`x' == 1 {
			local sign_`var'_`x' = "0"
			}
			
		}
		
	gen sign_cap_zero_`x' = (`p_cap_`x''>0.1)
	gen sign_cap_p1s_`x' = (`p_cap_`x''<=0.1 & `p_cap_`x''>0.05 & `est_cap_`x''>0)
	gen sign_cap_p2s_`x' = (`p_cap_`x''<=0.05 & `p_cap_`x''>0.01 & `est_cap_`x''>0)
	gen sign_cap_p3s_`x' = (`p_cap_`x''<=0.01 & `p_cap_`x''>=0 & `est_cap_`x''>0)
	gen sign_cap_m1s_`x' = (`p_cap_`x''<=0.1 & `p_cap_`x''>0.05 & `est_cap_`x''<0)
	gen sign_cap_m2s_`x' = (`p_cap_`x''<=0.05 & `p_cap_`x''>0.01 & `est_cap_`x''<0)
	gen sign_cap_m3s_`x' = (`p_cap_`x''<=0.01 & `p_cap_`x''>=0 & `est_cap_`x''<0)
	
	local p_cap_`x' = string(`p_cap_`x'',"%9.3fc")
	local est_cap_`x' = string(`est_cap_`x'',"%9.3fc")
	local se_cap_`x' = string(`se_cap_`x'',"%9.3fc")
	
	if sign_cap_p1s_`x' == 1 {
			local sign_cap_`x' = "\cellcolor[HTML]{EFEFEF}+"
			local est_cap_`x' = "`est_cap_`x''*"
			}
			
	if sign_cap_p2s_`x' == 1 {	
			local sign_cap_`x' = "\cellcolor[HTML]{C0C0C0}+"
			local est_cap_`x' = "`est_cap_`x''**"
			}
			
	if sign_cap_p3s_`x' == 1 {	
			local sign_cap_`x' = "\cellcolor[HTML]{9B9B9B}+"
			local est_cap_`x' = "`est_cap_`x''***"
			}
		
	if sign_cap_m1s_`x' == 1 {
			local sign_cap_`x' = "\cellcolor[HTML]{EFEFEF}-"
			local est_cap_`x' = "`est_cap_`x''*"
			}
			
	if sign_cap_m2s_`x' == 1 {	
			local sign_cap_`x' = "\cellcolor[HTML]{C0C0C0}-"
			local est_cap_`x' = "`est_cap_`x''**"
			}
			
	if sign_cap_m3s_`x' == 1 {	
			local sign_cap_`x' = "\cellcolor[HTML]{9B9B9B}-"
			local est_cap_`x' = "`est_cap_`x''***"
			}
		
	if sign_cap_zero_`x' == 1 {
		local sign_cap_`x' = "0"
		}
	
	drop sign_*

	* Subgroup Effects: Community Monitoring
	
	* We local the vector of controls with HC level components
	
	local e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_hc
		
		local `x'controls_tfull
		local `x'controls_tfull_hc
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
		
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			
			}
		}
				
	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		
		local e_controls_hc `e_controls_hc' c_hc_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
		
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			
			}
		}
	local x healthout_z
	
	areg e_`x' treatfull treatfull_commtg b_commtg_z_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		
	eststo e_`x'_commtg
	local n_commtg_`x' = string(e(N),"%9.0fc")
	local r2_commtg_`x' = string(e(r2),"%9.3fc")
	
	lincom treatfull + treatfull_commtg
	local est_commtg_`x' = r(estimate)
	local se_commtg_`x' = r(se)
	test treatfull + treatfull_commtg = 0
	local p_commtg_`x' = r(p)
	
	local est_bcommtg_`x' = string(_b[treatfull],"%9.3fc")
	local se_bcommtg_`x' = string(_se[treatfull],"%9.3fc")
	local p_bcommtg_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
	
	local est_tmxcommtg_`x' = string(_b[treatfull_commtg],"%9.3fc")
	local se_tmxcommtg_`x' = string(_se[treatfull_commtg],"%9.3fc")
	local p_tmxcommtg_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_commtg]/_se[treatfull_commtg])))
	
	local est_smcommtg_`x' = string(_b[b_commtg_z_med_d],"%9.3fc")
	local se_smcommtg_`x' = string(_se[b_commtg_z_med_d],"%9.3fc")
	local p_smcommtg_`x' = (2 * ttail(e(df_r), abs(_b[b_commtg_z_med_d]/_se[b_commtg_z_med_d])))
	
	local est_ccommtg_`x' = string(_b[_cons],"%9.3fc")
	local se_ccommtg_`x' = string(_se[_cons],"%9.3fc")
	local p_ccommtg_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
	
	foreach var in bcommtg tmxcommtg smcommtg ccommtg {
	
		gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
		gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
		gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
		gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
		gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
		gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
		gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
		
		if sign_`var'_p1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_p2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_p3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_m1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_m2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_m3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_zero_`x' == 1 {
			local sign_`var'_`x' = "0"
			}
			
		}
		
	gen sign_commtg_zero_`x' = (`p_commtg_`x''>0.1)
	gen sign_commtg_p1s_`x' = (`p_commtg_`x''<=0.1 & `p_commtg_`x''>0.05 & `est_commtg_`x''>0)
	gen sign_commtg_p2s_`x' = (`p_commtg_`x''<=0.05 & `p_commtg_`x''>0.01 & `est_commtg_`x''>0)
	gen sign_commtg_p3s_`x' = (`p_commtg_`x''<=0.01 & `p_commtg_`x''>=0 & `est_commtg_`x''>0)
	gen sign_commtg_m1s_`x' = (`p_commtg_`x''<=0.1 & `p_commtg_`x''>0.05 & `est_commtg_`x''<0)
	gen sign_commtg_m2s_`x' = (`p_commtg_`x''<=0.05 & `p_commtg_`x''>0.01 & `est_commtg_`x''<0)
	gen sign_commtg_m3s_`x' = (`p_commtg_`x''<=0.01 & `p_commtg_`x''>=0 & `est_commtg_`x''<0)
	
	local p_commtg_`x' = string(`p_commtg_`x'',"%9.3fc")
	local est_commtg_`x' = string(`est_commtg_`x'',"%9.3fc")
	local se_commtg_`x' = string(`se_commtg_`x'',"%9.3fc")
	
	if sign_commtg_p1s_`x' == 1 {
			local sign_commtg_`x' = "\cellcolor[HTML]{EFEFEF}+"
			local est_commtg_`x' = "`est_commtg_`x''*"
			}
			
	if sign_commtg_p2s_`x' == 1 {	
			local sign_commtg_`x' = "\cellcolor[HTML]{C0C0C0}+"
			local est_commtg_`x' = "`est_commtg_`x''**"
			}
			
	if sign_commtg_p3s_`x' == 1 {	
			local sign_commtg_`x' = "\cellcolor[HTML]{9B9B9B}+"
			local est_commtg_`x' = "`est_commtg_`x''***"
			}
		
	if sign_commtg_m1s_`x' == 1 {
			local sign_commtg_`x' = "\cellcolor[HTML]{EFEFEF}-"
			local est_commtg_`x' = "`est_commtg_`x''*"
			}
			
	if sign_commtg_m2s_`x' == 1 {	
			local sign_commtg_`x' = "\cellcolor[HTML]{C0C0C0}-"
			local est_commtg_`x' = "`est_commtg_`x''**"
			}
			
	if sign_commtg_m3s_`x' == 1 {	
			local sign_commtg_`x' = "\cellcolor[HTML]{9B9B9B}-"
			local est_commtg_`x' = "`est_commtg_`x''***"
			}
		
	if sign_commtg_zero_`x' == 1 {
		local sign_commtg_`x' = "0"
		}
	
	drop sign_*
		
	* Subgroup Effects: Efficacy
	
	* We regress the results
	
	local x healthout_z
	
	areg e_`x' treatfull treatfull_eff b_eff_z_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		
	eststo e_`x'_eff
	local n_eff_`x' = string(e(N),"%9.0fc")
	local r2_eff_`x' = string(e(r2),"%9.3fc")
	
	lincom treatfull + treatfull_eff
	local est_eff_`x' = r(estimate)
	local se_eff_`x' = r(se)
	test treatfull + treatfull_eff = 0
	local p_eff_`x' = r(p)
	
	local est_beff_`x' = string(_b[treatfull],"%9.3fc")
	local se_beff_`x' = string(_se[treatfull],"%9.3fc")
	local p_beff_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
	
	local est_tmxeff_`x' = string(_b[treatfull_eff],"%9.3fc")
	local se_tmxeff_`x' = string(_se[treatfull_eff],"%9.3fc")
	local p_tmxeff_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_eff]/_se[treatfull_eff])))
	
	local est_smeff_`x' = string(_b[b_eff_z_med_d],"%9.3fc")
	local se_smeff_`x' = string(_se[b_eff_z_med_d],"%9.3fc")
	local p_smeff_`x' = (2 * ttail(e(df_r), abs(_b[b_eff_z_med_d]/_se[b_eff_z_med_d])))
	
	local est_ceff_`x' = string(_b[_cons],"%9.3fc")
	local se_ceff_`x' = string(_se[_cons],"%9.3fc")
	local p_ceff_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
	
	foreach var in beff tmxeff smeff ceff {
	
		gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
		gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
		gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
		gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
		gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
		gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
		gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
		
		if sign_`var'_p1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_p2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_p3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_m1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_m2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_m3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_zero_`x' == 1 {
			local sign_`var'_`x' = "0"
			}
			
		}
		
	gen sign_eff_zero_`x' = (`p_eff_`x''>0.1)
	gen sign_eff_p1s_`x' = (`p_eff_`x''<=0.1 & `p_eff_`x''>0.05 & `est_eff_`x''>0)
	gen sign_eff_p2s_`x' = (`p_eff_`x''<=0.05 & `p_eff_`x''>0.01 & `est_eff_`x''>0)
	gen sign_eff_p3s_`x' = (`p_eff_`x''<=0.01 & `p_eff_`x''>=0 & `est_eff_`x''>0)
	gen sign_eff_m1s_`x' = (`p_eff_`x''<=0.1 & `p_eff_`x''>0.05 & `est_eff_`x''<0)
	gen sign_eff_m2s_`x' = (`p_eff_`x''<=0.05 & `p_eff_`x''>0.01 & `est_eff_`x''<0)
	gen sign_eff_m3s_`x' = (`p_eff_`x''<=0.01 & `p_eff_`x''>=0 & `est_eff_`x''<0)
	
	local p_eff_`x' = string(`p_eff_`x'',"%9.3fc")
	local est_eff_`x' = string(`est_eff_`x'',"%9.3fc")
	local se_eff_`x' = string(`se_eff_`x'',"%9.3fc")
	
	if sign_eff_p1s_`x' == 1 {
			local sign_eff_`x' = "\cellcolor[HTML]{EFEFEF}+"
			local est_eff_`x' = "`est_eff_`x''*"
			}
			
	if sign_eff_p2s_`x' == 1 {	
			local sign_eff_`x' = "\cellcolor[HTML]{C0C0C0}+"
			local est_eff_`x' = "`est_eff_`x''**"
			}
			
	if sign_eff_p3s_`x' == 1 {	
			local sign_eff_`x' = "\cellcolor[HTML]{9B9B9B}+"
			local est_eff_`x' = "`est_eff_`x''***"
			}
		
	if sign_eff_m1s_`x' == 1 {
			local sign_eff_`x' = "\cellcolor[HTML]{EFEFEF}-"
			local est_eff_`x' = "`est_eff_`x''*"
			}
			
	if sign_eff_m2s_`x' == 1 {	
			local sign_eff_`x' = "\cellcolor[HTML]{C0C0C0}-"
			local est_eff_`x' = "`est_eff_`x''**"
			}
			
	if sign_eff_m3s_`x' == 1 {	
			local sign_eff_`x' = "\cellcolor[HTML]{9B9B9B}-"
			local est_eff_`x' = "`est_eff_`x''***"
			}
		
	if sign_eff_zero_`x' == 1 {
		local sign_eff_`x' = "0"
		}
	
	drop sign_*

	* Subgroup Effects: Distance to HC
	
	* We local the vector of control without HC level components
	
	local e_controls_noprefix b_visited_d educyr b_assetindex
		
	foreach x in e_ {
		
		local `x'controls
		local `x'controls_tfull
			
		}
		
	foreach x in e_ {
		foreach var in treatfull {
			local `var'_int_`x'controls
			}
		}

	foreach var of local e_controls_noprefix {
		local e_controls `e_controls' c_`var'
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		}
			
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			}
		}
	
	* We regress the results

	local x healthout_z
	
	areg e_`x' treatfull treatfull_distance b_distance_hc_z_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
	
	eststo e_`x'_distance
	local n_distance_`x' = string(e(N),"%9.0fc")
	local r2_distance_`x' = string(e(r2),"%9.3fc")
	
	lincom treatfull + treatfull_distance
	local est_distance_`x' = r(estimate)
	local se_distance_`x' = r(se)
	test treatfull + treatfull_distance = 0
	local p_distance_`x' = r(p)
	
	local est_bdistance_`x' = string(_b[treatfull],"%9.3fc")
	local se_bdistance_`x' = string(_se[treatfull],"%9.3fc")
	local p_bdistance_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
	
	local est_tmxdist_`x' = string(_b[treatfull_distance],"%9.3fc")
	local se_tmxdist_`x' = string(_se[treatfull_distance],"%9.3fc")
	local p_tmxdist_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_distance]/_se[treatfull_distance])))
	
	local est_smdist_`x' = string(_b[b_distance_hc_z_med_d],"%9.3fc")
	local se_smdist_`x' = string(_se[b_distance_hc_z_med_d],"%9.3fc")
	local p_smdist_`x' = (2 * ttail(e(df_r), abs(_b[b_distance_hc_z_med_d]/_se[b_distance_hc_z_med_d])))
	
	local est_cdist_`x' = string(_b[_cons],"%9.3fc")
	local se_cdist_`x' = string(_se[_cons],"%9.3fc")
	local p_cdist_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
	
	foreach var in bdistance tmxdist smdist cdist {
	
		gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
		gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
		gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
		gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
		gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
		gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
		gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
		
		if sign_`var'_p1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_p2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_p3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_m1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_m2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_m3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_zero_`x' == 1 {
			local sign_`var'_`x' = "0"
			}
			
		}
		
	gen sign_distance_zero_`x' = (`p_distance_`x''>0.1)
	gen sign_distance_p1s_`x' = (`p_distance_`x''<=0.1 & `p_distance_`x''>0.05 & `est_distance_`x''>0)
	gen sign_distance_p2s_`x' = (`p_distance_`x''<=0.05 & `p_distance_`x''>0.01 & `est_distance_`x''>0)
	gen sign_distance_p3s_`x' = (`p_distance_`x''<=0.01 & `p_distance_`x''>=0 & `est_distance_`x''>0)
	gen sign_distance_m1s_`x' = (`p_distance_`x''<=0.1 & `p_distance_`x''>0.05 & `est_distance_`x''<0)
	gen sign_distance_m2s_`x' = (`p_distance_`x''<=0.05 & `p_distance_`x''>0.01 & `est_distance_`x''<0)
	gen sign_distance_m3s_`x' = (`p_distance_`x''<=0.01 & `p_distance_`x''>=0 & `est_distance_`x''<0)
	
	local p_distance_`x' = string(`p_distance_`x'',"%9.3fc")
	local est_distance_`x' = string(`est_distance_`x'',"%9.3fc")
	local se_distance_`x' = string(`se_distance_`x'',"%9.3fc")
	
	if sign_distance_p1s_`x' == 1 {
			local sign_distance_`x' = "\cellcolor[HTML]{EFEFEF}+"
			local est_distance_`x' = "`est_distance_`x''*"
			}
			
	if sign_distance_p2s_`x' == 1 {	
			local sign_distance_`x' = "\cellcolor[HTML]{C0C0C0}+"
			local est_distance_`x' = "`est_distance_`x''**"
			}
			
	if sign_distance_p3s_`x' == 1 {	
			local sign_distance_`x' = "\cellcolor[HTML]{9B9B9B}+"
			local est_distance_`x' = "`est_distance_`x''***"
			}
		
	if sign_distance_m1s_`x' == 1 {
			local sign_distance_`x' = "\cellcolor[HTML]{EFEFEF}-"
			local est_distance_`x' = "`est_distance_`x''*"
			}
			
	if sign_distance_m2s_`x' == 1 {	
			local sign_distance_`x' = "\cellcolor[HTML]{C0C0C0}-"
			local est_distance_`x' = "`est_distance_`x''**"
			}
			
	if sign_distance_m3s_`x' == 1 {	
			local sign_distance_`x' = "\cellcolor[HTML]{9B9B9B}-"
			local est_distance_`x' = "`est_distance_`x''***"
			}
		
	if sign_distance_zero_`x' == 1 {
		local sign_distance_`x' = "0"
		}
	
	drop sign_*
		
	* Subgroup Effects: Urban Area
	
	local x healthout_z
	
	areg e_`x' treatfull treatfull_urbanarea b_h_urb_area b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
	
	eststo e_`x'_urbanarea
	local n_urbanarea_`x' = string(e(N),"%9.0fc")
	local r2_urbanarea_`x' = string(e(r2),"%9.3fc")
	
	lincom treatfull + treatfull_urbanarea
	local est_urbanarea_`x' = r(estimate)
	local se_urbanarea_`x' = r(se)
	test treatfull + treatfull_urbanarea = 0
	local p_urbanarea_`x' = r(p)
	
	local est_ruralarea_`x' = string(_b[treatfull],"%9.3fc")
	local se_ruralarea_`x' = string(_se[treatfull],"%9.3fc")
	local p_ruralarea_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
	
	local est_tmxrural_`x' = string(_b[treatfull_urbanarea],"%9.3fc")
	local se_tmxrural_`x' = string(_se[treatfull_urbanarea],"%9.3fc")
	local p_tmxrural_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_urbanarea]/_se[treatfull_urbanarea])))
		
	local est_smrural_`x' = string(_b[b_h_urb_area],"%9.3fc")
	local se_smrural_`x' = string(_se[b_h_urb_area],"%9.3fc")
	local p_smrural_`x' = (2 * ttail(e(df_r), abs(_b[b_h_urb_area]/_se[b_h_urb_area])))
	
	local est_crural_`x' = string(_b[_cons],"%9.3fc")
	local se_crural_`x' = string(_se[_cons],"%9.3fc")
	local p_crural_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
	
	foreach var in ruralarea tmxrural smrural crural {
		
		gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
		gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
		gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
		gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
		gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
		gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
		gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
		
		if sign_`var'_p1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_p2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_p3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_m1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_m2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_m3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_zero_`x' == 1 {
			local sign_`var'_`x' = "0"
			}
			
		}
	
	gen sign_urbanarea_zero_`x' = (`p_urbanarea_`x''>0.1)
	gen sign_urbanarea_p1s_`x' = (`p_urbanarea_`x''<=0.1 & `p_urbanarea_`x''>0.05 & `est_urbanarea_`x''>0)
	gen sign_urbanarea_p2s_`x' = (`p_urbanarea_`x''<=0.05 & `p_urbanarea_`x''>0.01 & `est_urbanarea_`x''>0)
	gen sign_urbanarea_p3s_`x' = (`p_urbanarea_`x''<=0.01 & `p_urbanarea_`x''>=0 & `est_urbanarea_`x''>0)
	gen sign_urbanarea_m1s_`x' = (`p_urbanarea_`x''<=0.1 & `p_urbanarea_`x''>0.05 & `est_urbanarea_`x''<0)
	gen sign_urbanarea_m2s_`x' = (`p_urbanarea_`x''<=0.05 & `p_urbanarea_`x''>0.01 & `est_urbanarea_`x''<0)
	gen sign_urbanarea_m3s_`x' = (`p_urbanarea_`x''<=0.01 & `p_urbanarea_`x''>=0 & `est_urbanarea_`x''<0)
	
	local p_urbanarea_`x' = string(`p_urbanarea_`x'',"%9.3fc")
	local est_urbanarea_`x' = string(`est_urbanarea_`x'',"%9.3fc")
	local se_urbanarea_`x' = string(`se_urbanarea_`x'',"%9.3fc")
	
	if sign_urbanarea_p1s_`x' == 1 {
			local sign_urbanarea_`x' = "\cellcolor[HTML]{EFEFEF}+"
			local est_urbanarea_`x' = "`est_urbanarea_`x''*"
			}
			
	if sign_urbanarea_p2s_`x' == 1 {	
			local sign_urbanarea_`x' = "\cellcolor[HTML]{C0C0C0}+"
			local est_urbanarea_`x' = "`est_urbanarea_`x''**"
			}
			
	if sign_urbanarea_p3s_`x' == 1 {	
			local sign_urbanarea_`x' = "\cellcolor[HTML]{9B9B9B}+"
			local est_urbanarea_`x' = "`est_urbanarea_`x''***"
			}
		
	if sign_urbanarea_m1s_`x' == 1 {
			local sign_urbanarea_`x' = "\cellcolor[HTML]{EFEFEF}-"
			local est_urbanarea_`x' = "`est_urbanarea_`x''*"
			}
			
	if sign_urbanarea_m2s_`x' == 1 {	
			local sign_urbanarea_`x' = "\cellcolor[HTML]{C0C0C0}-"
			local est_urbanarea_`x' = "`est_urbanarea_`x''**"
			}
			
	if sign_urbanarea_m3s_`x' == 1 {	
			local sign_urbanarea_`x' = "\cellcolor[HTML]{9B9B9B}-"
			local est_urbanarea_`x' = "`est_urbanarea_`x''***"
			}
		
	if sign_urbanarea_zero_`x' == 1 {
		local sign_urbanarea_`x' = "0"
		}
	
	drop sign_*
	
	* Subgroup Effects: NGO presence
	
	local x healthout_z
	
	areg e_`x' treatfull treatfull_ngo_hc b_ngo_hc b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
	
	eststo e_`x'_ngo
	local n_ngo_`x' = string(e(N),"%9.0fc")
	local r2_ngo_`x' = string(e(r2),"%9.3fc")
	
	lincom treatfull + treatfull_ngo_hc
	local est_ngo_`x' = r(estimate)
	local se_ngo_`x' = r(se)
	test treatfull + treatfull_ngo_hc = 0
	local p_ngo_`x' = r(p)
	
	local est_bngo_`x' = string(_b[treatfull],"%9.3fc")
	local se_bngo_`x' = string(_se[treatfull],"%9.3fc")
	local p_bngo_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
	
	local est_tmxngo_`x' = string(_b[treatfull_ngo_hc],"%9.3fc")
	local se_tmxngo_`x' = string(_se[treatfull_ngo_hc],"%9.3fc")
	local p_tmxngo_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_ngo_hc]/_se[treatfull_ngo_hc])))
	
	local est_smngo_`x' = string(_b[b_ngo_hc],"%9.3fc")
	local se_smngo_`x' = string(_se[b_ngo_hc],"%9.3fc")
	local p_smngo_`x' = (2 * ttail(e(df_r), abs(_b[b_ngo_hc]/_se[b_ngo_hc])))
	
	local est_cngo_`x' = string(_b[_cons],"%9.3fc")
	local se_cngo_`x' = string(_se[_cons],"%9.3fc")
	local p_cngo_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
	
	foreach var in bngo tmxngo smngo cngo {
	
		gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
		gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
		gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
		gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
		gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
		gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
		gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
		
		if sign_`var'_p1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_p2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_p3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_m1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_m2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_m3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_zero_`x' == 1 {
			local sign_`var'_`x' = "0"
			}
			
		}
		
	gen sign_ngo_zero_`x' = (`p_ngo_`x''>0.1)
	gen sign_ngo_p1s_`x' = (`p_ngo_`x''<=0.1 & `p_ngo_`x''>0.05 & `est_ngo_`x''>0)
	gen sign_ngo_p2s_`x' = (`p_ngo_`x''<=0.05 & `p_ngo_`x''>0.01 & `est_ngo_`x''>0)
	gen sign_ngo_p3s_`x' = (`p_ngo_`x''<=0.01 & `p_ngo_`x''>=0 & `est_ngo_`x''>0)
	gen sign_ngo_m1s_`x' = (`p_ngo_`x''<=0.1 & `p_ngo_`x''>0.05 & `est_ngo_`x''<0)
	gen sign_ngo_m2s_`x' = (`p_ngo_`x''<=0.05 & `p_ngo_`x''>0.01 & `est_ngo_`x''<0)
	gen sign_ngo_m3s_`x' = (`p_ngo_`x''<=0.01 & `p_ngo_`x''>=0 & `est_ngo_`x''<0)
	
	local p_ngo_`x' = string(`p_ngo_`x'',"%9.3fc")
	local est_ngo_`x' = string(`est_ngo_`x'',"%9.3fc")
	local se_ngo_`x' = string(`se_ngo_`x'',"%9.3fc")
	
	if sign_ngo_p1s_`x' == 1 {
			local sign_ngo_`x' = "\cellcolor[HTML]{EFEFEF}+"
			local est_ngo_`x' = "`est_ngo_`x''*"
			}
			
	if sign_ngo_p2s_`x' == 1 {	
			local sign_ngo_`x' = "\cellcolor[HTML]{C0C0C0}+"
			local est_ngo_`x' = "`est_ngo_`x''**"
			}
			
	if sign_ngo_p3s_`x' == 1 {	
			local sign_ngo_`x' = "\cellcolor[HTML]{9B9B9B}+"
			local est_ngo_`x' = "`est_ngo_`x''***"
			}
		
	if sign_ngo_m1s_`x' == 1 {
			local sign_ngo_`x' = "\cellcolor[HTML]{EFEFEF}-"
			local est_ngo_`x' = "`est_ngo_`x''*"
			}
			
	if sign_ngo_m2s_`x' == 1 {	
			local sign_ngo_`x' = "\cellcolor[HTML]{C0C0C0}-"
			local est_ngo_`x' = "`est_ngo_`x''**"
			}
			
	if sign_ngo_m3s_`x' == 1 {	
			local sign_ngo_`x' = "\cellcolor[HTML]{9B9B9B}-"
			local est_ngo_`x' = "`est_ngo_`x''***"
			}
		
	if sign_ngo_zero_`x' == 1 {
		local sign_ngo_`x' = "0"
		}
		
	drop sign_*

	* Subgroup Effects: Baseline U5M
	
	local x healthout_z
	
	areg e_`x' treatfull treatfull_u5m_hc b_h_u5mortality_med_d b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
		
	eststo e_`x'_
	local n_u5m_`x' = string(e(N),"%9.0fc")
	local r2_u5m_`x' = string(e(r2),"%9.3fc")
	
	lincom treatfull + treatfull_u5m_hc
	local est_u5m_`x' = r(estimate)
	local se_u5m_`x' = r(se)
	test treatfull + treatfull_u5m_hc = 0
	local p_u5m_`x' = r(p)
	
	local est_bu5m_`x' = string(_b[treatfull],"%9.3fc")
	local se_bu5m_`x' = string(_se[treatfull],"%9.3fc")
	local p_bu5m_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
	
	local est_tmxu5m_`x' = string(_b[treatfull_u5m_hc],"%9.3fc")
	local se_tmxu5m_`x' = string(_se[treatfull_u5m_hc],"%9.3fc")
	local p_tmxu5m_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_u5m_hc]/_se[treatfull_u5m_hc])))
	
	local est_smu5m_`x' = string(_b[b_h_u5mortality_med_d],"%9.3fc")
	local se_smu5m_`x' = string(_se[b_h_u5mortality_med_d],"%9.3fc")
	local p_smu5m_`x' = (2 * ttail(e(df_r), abs(_b[b_h_u5mortality_med_d]/_se[b_h_u5mortality_med_d])))
	
	local est_cu5m_`x' = string(_b[_cons],"%9.3fc")
	local se_cu5m_`x' = string(_se[_cons],"%9.3fc")
	local p_cu5m_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
	
	foreach var in bu5m tmxu5m smu5m cu5m {
	
		gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
		gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
		gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
		gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
		gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
		gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
		gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
		
		if sign_`var'_p1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_p2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_p3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_m1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_m2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_m3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_zero_`x' == 1 {
			local sign_`var'_`x' = "0"
			}
			
		}
		
	gen sign_u5m_zero_`x' = (`p_u5m_`x''>0.1)
	gen sign_u5m_p1s_`x' = (`p_u5m_`x''<=0.1 & `p_u5m_`x''>0.05 & `est_u5m_`x''>0)
	gen sign_u5m_p2s_`x' = (`p_u5m_`x''<=0.05 & `p_u5m_`x''>0.01 & `est_u5m_`x''>0)
	gen sign_u5m_p3s_`x' = (`p_u5m_`x''<=0.01 & `p_u5m_`x''>=0 & `est_u5m_`x''>0)
	gen sign_u5m_m1s_`x' = (`p_u5m_`x''<=0.1 & `p_u5m_`x''>0.05 & `est_u5m_`x''<0)
	gen sign_u5m_m2s_`x' = (`p_u5m_`x''<=0.05 & `p_u5m_`x''>0.01 & `est_u5m_`x''<0)
	gen sign_u5m_m3s_`x' = (`p_u5m_`x''<=0.01 & `p_u5m_`x''>=0 & `est_u5m_`x''<0)
	
	local p_u5m_`x' = string(`p_u5m_`x'',"%9.3fc")
	local est_u5m_`x' = string(`est_u5m_`x'',"%9.3fc")
	local se_u5m_`x' = string(`se_u5m_`x'',"%9.3fc")
	
	if sign_u5m_p1s_`x' == 1 {
			local sign_u5m_`x' = "\cellcolor[HTML]{EFEFEF}+"
			local est_u5m_`x' = "`est_u5m_`x''*"
			}
			
	if sign_u5m_p2s_`x' == 1 {	
			local sign_u5m_`x' = "\cellcolor[HTML]{C0C0C0}+"
			local est_u5m_`x' = "`est_u5m_`x''**"
			}
			
	if sign_u5m_p3s_`x' == 1 {	
			local sign_u5m_`x' = "\cellcolor[HTML]{9B9B9B}+"
			local est_u5m_`x' = "`est_u5m_`x''***"
			}
		
	if sign_u5m_m1s_`x' == 1 {
			local sign_u5m_`x' = "\cellcolor[HTML]{EFEFEF}-"
			local est_u5m_`x' = "`est_u5m_`x''*"
			}
			
	if sign_u5m_m2s_`x' == 1 {	
			local sign_u5m_`x' = "\cellcolor[HTML]{C0C0C0}-"
			local est_u5m_`x' = "`est_u5m_`x''**"
			}
			
	if sign_u5m_m3s_`x' == 1 {	
			local sign_u5m_`x' = "\cellcolor[HTML]{9B9B9B}-"
			local est_u5m_`x' = "`est_u5m_`x''***"
			}
		
	if sign_u5m_zero_`x' == 1 {
		local sign_u5m_`x' = "0"
		}
		
	drop sign_*
	
	********************
	* Individual level *
	********************
	
	use "${usedata}/healthoutcome_endline_ind.dta", clear
	
	* We merge the different indices
	
	merge m:1 hc_id using "`bu5m'"
	
	* We will create the interaction terms
	
	foreach var in u5_p2p {
	
		gen treatfull_`var' = treatfull * `var'
		la var treatfull_`var' "treatfull * `var'"
		
		}
		
	
	* We now run the subgroup analysis for the P2P 1 SD components
	
	ren e_healthoutcome_z e_healthout_z
	ren b_healthoutcome_z b_healthout_z
	ren b_healthoutcome_z_d b_healthout_z_d
	
	
	* Subgroup Effects: Baseline U5M 1 SD P2P
	
	local x healthout_z
	
	areg e_`x' treatfull treatfull_u5_p2p u5_p2p b_`x' b_`x'_d `e_controls_tfull' `treatfull_int_e_controls', robust cl(hc_id) a(district)
	
	eststo e_`x'_u5mp2p
	local n_u5mp2p_`x' = string(e(N),"%9.0fc")
	local r2_u5mp2p_`x' = string(e(r2),"%9.3fc")
	
	lincom treatfull + treatfull_u5_p2p
	local est_u5mp2p_`x' = r(estimate)
	local se_u5mp2p_`x' = r(se)
	test treatfull + treatfull_u5_p2p = 0
	local p_u5mp2p_`x' = r(p)
	
	local est_bu5mp2p_`x' = string(_b[treatfull],"%9.3fc")
	local se_bu5mp2p_`x' = string(_se[treatfull],"%9.3fc")
	local p_bu5mp2p_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
	
	local est_tmxu5mp2p_`x' = string(_b[treatfull_u5_p2p],"%9.3fc")
	local se_tmxu5mp2p_`x' = string(_se[treatfull_u5_p2p],"%9.3fc")
	local p_tmxu5mp2p_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_u5_p2p]/_se[treatfull_u5_p2p])))
	
	local est_smu5mp2p_`x' = string(_b[u5_p2p],"%9.3fc")
	local se_smu5mp2p_`x' = string(_se[u5_p2p],"%9.3fc")
	local p_smu5mp2p_`x' = (2 * ttail(e(df_r), abs(_b[u5_p2p]/_se[u5_p2p])))
	
	local est_cu5mp2p_`x' = string(_b[_cons],"%9.3fc")
	local se_cu5mp2p_`x' = string(_se[_cons],"%9.3fc")
	local p_cu5mp2p_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
	
	foreach var in bu5mp2p tmxu5mp2p smu5mp2p cu5mp2p {
	
		gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
		gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
		gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
		gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
		gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
		gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
		gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
		
		if sign_`var'_p1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_p2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_p3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_m1s_`x' == 1 {
				local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_`var'_`x' = "`est_`var'_`x''*"
				}
				
		if sign_`var'_m2s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_`var'_`x' = "`est_`var'_`x''**"
				}
				
		if sign_`var'_m3s_`x' == 1 {	
				local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_`var'_`x' = "`est_`var'_`x''***"
				}
			
		if sign_`var'_zero_`x' == 1 {
			local sign_`var'_`x' = "0"
			}
			
		}
		
	gen sign_u5mp2p_zero_`x' = (`p_u5mp2p_`x''>0.1)
	gen sign_u5mp2p_p1s_`x' = (`p_u5mp2p_`x''<=0.1 & `p_u5mp2p_`x''>0.05 & `est_u5mp2p_`x''>0)
	gen sign_u5mp2p_p2s_`x' = (`p_u5mp2p_`x''<=0.05 & `p_u5mp2p_`x''>0.01 & `est_u5mp2p_`x''>0)
	gen sign_u5mp2p_p3s_`x' = (`p_u5mp2p_`x''<=0.01 & `p_u5mp2p_`x''>=0 & `est_u5mp2p_`x''>0)
	gen sign_u5mp2p_m1s_`x' = (`p_u5mp2p_`x''<=0.1 & `p_u5mp2p_`x''>0.05 & `est_u5mp2p_`x''<0)
	gen sign_u5mp2p_m2s_`x' = (`p_u5mp2p_`x''<=0.05 & `p_u5mp2p_`x''>0.01 & `est_u5mp2p_`x''<0)
	gen sign_u5mp2p_m3s_`x' = (`p_u5mp2p_`x''<=0.01 & `p_u5mp2p_`x''>=0 & `est_u5mp2p_`x''<0)
	
	local p_u5mp2p_`x' = string(`p_u5mp2p_`x'',"%9.3fc")
	local est_u5mp2p_`x' = string(`est_u5mp2p_`x'',"%9.3fc")
	local se_u5mp2p_`x' = string(`se_u5mp2p_`x'',"%9.3fc")
	
	if sign_u5mp2p_p1s_`x' == 1 {
			local sign_u5mp2p_`x' = "\cellcolor[HTML]{EFEFEF}+"
			local est_u5mp2p_`x' = "`est_u5mp2p_`x''*"
			}
			
	if sign_u5mp2p_p2s_`x' == 1 {	
			local sign_u5mp2p_`x' = "\cellcolor[HTML]{C0C0C0}+"
			local est_u5mp2p_`x' = "`est_u5mp2p_`x''**"
			}
			
	if sign_u5mp2p_p3s_`x' == 1 {	
			local sign_u5mp2p_`x' = "\cellcolor[HTML]{9B9B9B}+"
			local est_u5mp2p_`x' = "`est_u5mp2p_`x''***"
			}
		
	if sign_u5mp2p_m1s_`x' == 1 {
			local sign_u5mp2p_`x' = "\cellcolor[HTML]{EFEFEF}-"
			local est_u5mp2p_`x' = "`est_u5mp2p_`x''*"
			}
			
	if sign_u5mp2p_m2s_`x' == 1 {	
			local sign_u5mp2p_`x' = "\cellcolor[HTML]{C0C0C0}-"
			local est_u5mp2p_`x' = "`est_u5mp2p_`x''**"
			}
			
	if sign_u5mp2p_m3s_`x' == 1 {	
			local sign_u5mp2p_`x' = "\cellcolor[HTML]{9B9B9B}-"
			local est_u5mp2p_`x' = "`est_u5mp2p_`x''***"
			}
		
	if sign_u5mp2p_zero_`x' == 1 {
		local sign_u5mp2p_`x' = "0"
		}
		
	drop sign_*
	
	* We outsheet the table
	
	texdoc init "${tables}/TableI22.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \scriptsize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Subgroup treatment effects on main outcomes - Backwardness hypothesis}
	tex \begin{tabular}{l*{8}{g}}
	tex \toprule
	tex                                                    					& \multicolumn{1}{c}{(1)}         & \multicolumn{1}{c}{(2)}                                                          & \multicolumn{1}{c}{(3)}                                                             & \multicolumn{1}{c}{(4)}                                                        & \multicolumn{1}{c}{(5)}   & \multicolumn{1}{c}{(6)}  & \multicolumn{1}{c}{(7)}                                                       \\
	tex 																	& \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Citizen \\ monitoring\end{tabular}}} & \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Perceived \\ citizen \\ pressure\end{tabular}}}  & \multicolumn{1}{c}{\textbf{Utilization}} & \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Treatment \\ quality\end{tabular}}} & \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Patient \\ satisfaction\end{tabular}}} & \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Health \\ outcomes\end{tabular}}} & \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Child\\ mortality\end{tabular}}} \\
	tex \midrule
	tex \multirow{2}{*}{Treat}                                     & `est_hc3_commtg_z' & `est_hc3_h_ctzpre_z' & `est_hc3_urate_z'                            & `est_hc3_treatqual_z'                                                                             & `est_hc3_patsat_z'                                                                              & `est_hc3_healthout_z'                                                                          & `est_hc3_mortrate_05'                                                                          \\
    tex                                                            & (`se_hc3_commtg_z') & (`se_hc3_h_ctzpre_z') & (`se_hc3_urate_z')                          & (`se_hc3_treatqual_z')                                                                           & (`se_hc3_patsat_z')                                                                              & (`se_hc3_healthout_z')                                                                         & (`se_hc3_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat*HC2}                                     & `est_tmxhc3_commtg_z' & `est_tmxhc3_h_ctzpre_z' & `est_tmxhc3_urate_z'                            & `est_tmxhc3_treatqual_z'                                                                             & `est_tmxhc3_patsat_z'                                                                              & `est_tmxhc3_healthout_z'                                                                          & `est_tmxhc3_mortrate_05'                                                                          \\
    tex                                                            & (`se_tmxhc3_commtg_z') & (`se_tmxhc3_h_ctzpre_z') & (`se_tmxhc3_urate_z')                          & (`se_tmxhc3_treatqual_z')                                                                           & (`se_tmxhc3_patsat_z')                                                                              & (`se_tmxhc3_healthout_z')                                                                         & (`se_tmxhc3_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{HC2}                                     & `est_smhc3_commtg_z' & `est_smhc3_h_ctzpre_z' & `est_smhc3_urate_z'                            & `est_smhc3_treatqual_z'                                                                             & `est_smhc3_patsat_z'                                                                              & `est_smhc3_healthout_z'                                                                          & `est_smhc3_mortrate_05'                                                                          \\
    tex                                                            & (`se_smhc3_commtg_z') & (`se_smhc3_h_ctzpre_z') & (`se_smhc3_urate_z')                          & (`se_smhc3_treatqual_z')                                                                           & (`se_smhc3_patsat_z')                                                                              & (`se_smhc3_healthout_z')                                                                         & (`se_smhc3_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat+Treat*HC2}                                    & `est_hc2_commtg_z' & `est_hc2_h_ctzpre_z' & `est_hc2_urate_z'                            & `est_hc2_treatqual_z'                                                                             & `est_hc2_patsat_z'                                                                              & `est_hc2_healthout_z'                                                                          & `est_hc2_mortrate_05'                                                                          \\
    tex                                                            & (`se_hc2_commtg_z') & (`se_hc2_h_ctzpre_z') & (`se_hc2_urate_z')                          & (`se_hc2_treatqual_z')                                                                           & (`se_hc2_patsat_z')                                                                              & (`se_hc2_healthout_z')                                                                         & (`se_hc2_mortrate_05')                                                                         \\
	tex \midrule
	tex \multirow{2}{*}{Treat}                                     & `est_btreatqual_commtg_z'  & `est_btreatqual_h_ctzpre_z'  & `est_btreatqual_urate_z'                            & `est_btreatqual_treatqual_z'                                                                             & `est_btreatqual_patsat_z'                                                                              & `est_btreatqual_healthout_z'                                                                          & `est_btreatqual_mortrate_05'                                                                          \\
    tex                                                            & (`se_btreatqual_commtg_z') & (`se_btreatqual_h_ctzpre_z') & (`se_btreatqual_urate_z')                          & (`se_btreatqual_treatqual_z')                                                                           & (`se_btreatqual_patsat_z')                                                                              & (`se_btreatqual_healthout_z')                                                                         & (`se_btreatqual_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat*Low treatment quality}                                     & `est_tmxtqual_commtg_z' & `est_tmxtqual_h_ctzpre_z' & `est_tmxtqual_urate_z'                            & `est_tmxtqual_treatqual_z'                                                                             & `est_tmxtqual_patsat_z'                                                                              & `est_tmxtqual_healthout_z'                                                                          & `est_tmxtqual_mortrate_05'                                                                          \\
    tex                                                            & (`se_tmxtqual_commtg_z') & (`se_tmxtqual_h_ctzpre_z') & (`se_tmxtqual_urate_z')                          & (`se_tmxtqual_treatqual_z')                                                                           & (`se_tmxtqual_patsat_z')                                                                              & (`se_tmxtqual_healthout_z')                                                                         & (`se_tmxtqual_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Low treatment quality}                                     & `est_smtqual_commtg_z' & `est_smtqual_h_ctzpre_z' & `est_smtqual_urate_z'                            & `est_smtqual_treatqual_z'                                                                             & `est_smtqual_patsat_z'                                                                              & `est_smtqual_healthout_z'                                                                          & `est_smtqual_mortrate_05'                                                                          \\
    tex                                                            & (`se_smtqual_commtg_z')  & (`se_smtqual_h_ctzpre_z')  & (`se_smtqual_urate_z')                          & (`se_smtqual_treatqual_z')                                                                           & (`se_smtqual_patsat_z')                                                                              & (`se_smtqual_healthout_z')                                                                         & (`se_smtqual_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat+Treat*Low treatment quality}                                     & `est_treatqual_commtg_z' & `est_treatqual_h_ctzpre_z' & `est_treatqual_urate_z'                            & `est_treatqual_treatqual_z'                                                                             & `est_treatqual_patsat_z'                                                                              & `est_treatqual_healthout_z'                                                                          & `est_treatqual_mortrate_05'                                                                          \\
    tex                                                            & (`se_treatqual_commtg_z') & (`se_treatqual_h_ctzpre_z') & (`se_treatqual_urate_z')                          & (`se_treatqual_treatqual_z')                                                                           & (`se_treatqual_patsat_z')                                                                              & (`se_treatqual_healthout_z')                                                                         & (`se_treatqual_mortrate_05')                                                                         \\
	tex \midrule
	tex \multirow{2}{*}{Treat}                                     & `est_bu5m_commtg_z' & `est_bu5m_h_ctzpre_z' & `est_bu5m_urate_z'                            & `est_bu5m_treatqual_z'                                                                             & `est_bu5m_patsat_z'                                                                              & `est_bu5m_healthout_z'                                                                          & `est_bu5m_mortrate_05'                                                                          \\
    tex                                                            & (`se_bu5m_commtg_z') & (`se_bu5m_h_ctzpre_z') & (`se_bu5m_urate_z')                          & (`se_bu5m_treatqual_z')                                                                           & (`se_bu5m_patsat_z')                                                                              & (`se_bu5m_healthout_z')                                                                         & (`se_bu5m_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat*High U5MR (median)}                  & `est_tmxu5m_commtg_z' & `est_tmxu5m_h_ctzpre_z'                   & `est_tmxu5m_urate_z'                            & `est_tmxu5m_treatqual_z'                                                                             & `est_tmxu5m_patsat_z'                                                                              & `est_tmxu5m_healthout_z'                                                                          & `est_tmxu5m_mortrate_05'                                                                          \\
    tex                                                            & (`se_tmxu5m_commtg_z') & (`se_tmxu5m_h_ctzpre_z') & (`se_tmxu5m_urate_z')                          & (`se_tmxu5m_treatqual_z')                                                                           & (`se_tmxu5m_patsat_z')                                                                              & (`se_tmxu5m_healthout_z')                                                                         & (`se_tmxu5m_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{High U5MR (median)}                         & `est_smu5m_commtg_z' & `est_smu5m_h_ctzpre_z'            & `est_smu5m_urate_z'                            & `est_smu5m_treatqual_z'                                                                             & `est_smu5m_patsat_z'                                                                              & `est_smu5m_healthout_z'                                                                          & `est_smu5m_mortrate_05'                                                                          \\
    tex                                                            & (`se_smu5m_commtg_z') & (`se_smu5m_h_ctzpre_z') & (`se_smu5m_urate_z')                          & (`se_smu5m_treatqual_z')                                                                           & (`se_smu5m_patsat_z')                                                                              & (`se_smu5m_healthout_z')                                                                         & (`se_smu5m_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat+Treat*High U5MR (median)}            & `est_u5m_commtg_z' & `est_u5m_h_ctzpre_z'                         & `est_u5m_urate_z'                            & `est_u5m_treatqual_z'                                                                             & `est_u5m_patsat_z'                                                                              & `est_u5m_healthout_z'                                                                          & `est_u5m_mortrate_05'                                                                          \\
    tex                                                            & (`se_u5m_commtg_z')  & (`se_u5m_h_ctzpre_z')  & (`se_u5m_urate_z')                          & (`se_u5m_treatqual_z')                                                                           & (`se_u5m_patsat_z')                                                                              & (`se_u5m_healthout_z')                                                                         & (`se_u5m_mortrate_05')                                                                         \\
	tex \midrule
	tex \multirow{2}{*}{Treat}                                     & `est_bu5mp2p_commtg_z'  & `est_bu5mp2p_h_ctzpre_z'  & `est_bu5mp2p_urate_z'                            & `est_bu5mp2p_treatqual_z'                                                                             & `est_bu5mp2p_patsat_z'                                                                              & `est_bu5mp2p_healthout_z'                                                                          & `est_bu5mp2p_mortrate_05'                                                                          \\
    tex                                                            & (`se_bu5mp2p_commtg_z')  & (`se_bu5mp2p_h_ctzpre_z')  & (`se_bu5mp2p_urate_z')                          & (`se_bu5mp2p_treatqual_z')                                                                           & (`se_bu5mp2p_patsat_z')                                                                              & (`se_bu5mp2p_healthout_z')                                                                         & (`se_bu5mp2p_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat*High U5MR (w/i 1 SD of P2P)}      & `est_tmxu5mp2p_commtg_z' & `est_tmxu5mp2p_h_ctzpre_z'                               & `est_tmxu5mp2p_urate_z'                            & `est_tmxu5mp2p_treatqual_z'                                                                             & `est_tmxu5mp2p_patsat_z'                                                                              & `est_tmxu5mp2p_healthout_z'                                                                          & `est_tmxu5mp2p_mortrate_05'                                                                          \\
    tex                                                            & (`se_tmxu5mp2p_commtg_z') & (`se_tmxu5mp2p_h_ctzpre_z') & (`se_tmxu5mp2p_urate_z')                          & (`se_tmxu5mp2p_treatqual_z')                                                                           & (`se_tmxu5mp2p_patsat_z')                                                                              & (`se_tmxu5mp2p_healthout_z')                                                                         & (`se_tmxu5mp2p_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{High U5MR (w/i 1 SD of P2P)}                                     & `est_smu5mp2p_commtg_z' & `est_smu5mp2p_h_ctzpre_z' & `est_smu5mp2p_urate_z'                            & `est_smu5mp2p_treatqual_z'                                                                             & `est_smu5mp2p_patsat_z'                                                                              & `est_smu5mp2p_healthout_z'                                                                          & `est_smu5mp2p_mortrate_05'                                                                          \\
    tex                                                            & (`se_smu5mp2p_commtg_z') & (`se_smu5mp2p_h_ctzpre_z') & (`se_smu5mp2p_urate_z')                          & (`se_smu5mp2p_treatqual_z')                                                                           & (`se_smu5mp2p_patsat_z')                                                                              & (`se_smu5mp2p_healthout_z')                                                                         & (`se_smu5mp2p_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat+Treat*High U5MR (w/i 1 SD of P2P)} & `est_u5mp2p_commtg_z' & `est_u5mp2p_h_ctzpre_z'                                    & `est_u5mp2p_urate_z'                            & `est_u5mp2p_treatqual_z'                                                                             & `est_u5mp2p_patsat_z'                                                                              & `est_u5mp2p_healthout_z'                                                                          & `est_u5mp2p_mortrate_05'                                                                          \\
    tex                                                            & (`se_u5mp2p_commtg_z') & (`se_u5mp2p_h_ctzpre_z') & (`se_u5mp2p_urate_z')                          & (`se_u5mp2p_treatqual_z')                                                                           & (`se_u5mp2p_patsat_z')                                                                              & (`se_u5mp2p_healthout_z')                                                                         & (`se_u5mp2p_mortrate_05')                                                                         \\
	tex \midrule
	tex \multirow{2}{*}{Treat}                                     & `est_boutside_commtg_z' & `est_boutside_h_ctzpre_z' & `est_boutside_urate_z'                            & `est_boutside_treatqual_z'                                                                             & `est_boutside_patsat_z'                                                                              & `est_boutside_healthout_z'                                                                          & `est_boutside_mortrate_05'                                                                          \\
    tex                                                            & (`se_boutside_commtg_z') & (`se_boutside_h_ctzpre_z') & (`se_boutside_urate_z')                          & (`se_boutside_treatqual_z')                                                                           & (`se_boutside_patsat_z')                                                                              & (`se_boutside_healthout_z')                                                                         & (`se_boutside_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat*Few alternative options}                                 & `est_tmxoutside_commtg_z' & `est_tmxoutside_h_ctzpre_z'    & `est_tmxoutside_urate_z'                            & `est_tmxoutside_treatqual_z'                                                                             & `est_tmxoutside_patsat_z'                                                                              & `est_tmxoutside_healthout_z'                                                                          & `est_tmxoutside_mortrate_05'                                                                          \\
    tex                                                            & (`se_tmxoutside_commtg_z') & (`se_tmxoutside_h_ctzpre_z') & (`se_tmxoutside_urate_z')                          & (`se_tmxoutside_treatqual_z')                                                                           & (`se_tmxoutside_patsat_z')                                                                              & (`se_tmxoutside_healthout_z')                                                                         & (`se_tmxoutside_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Few alternative options}                                     & `est_smoutside_commtg_z'  & `est_smoutside_h_ctzpre_z'  & `est_smoutside_urate_z'                            & `est_smoutside_treatqual_z'                                                                             & `est_smoutside_patsat_z'                                                                              & `est_smoutside_healthout_z'                                                                          & `est_smoutside_mortrate_05'                                                                          \\
    tex                                                            & (`se_smoutside_commtg_z') & (`se_smoutside_h_ctzpre_z') & (`se_smoutside_urate_z')                          & (`se_smoutside_treatqual_z')                                                                           & (`se_smoutside_patsat_z')                                                                              & (`se_smoutside_healthout_z')                                                                         & (`se_smoutside_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat+Treat*Few alternative options}                                     & `est_outside_commtg_z' & `est_outside_h_ctzpre_z' & `est_outside_urate_z'                            & `est_outside_treatqual_z'                                                                             & `est_outside_patsat_z'                                                                              & `est_outside_healthout_z'                                                                          & `est_outside_mortrate_05'                                                                          \\
    tex                                                            & (`se_outside_commtg_z')  & (`se_outside_h_ctzpre_z')  & (`se_outside_urate_z')                          & (`se_outside_treatqual_z')                                                                           & (`se_outside_patsat_z')                                                                              & (`se_outside_healthout_z')                                                                         & (`se_outside_mortrate_05')                                                                         \\
	tex \midrule
	tex \multirow{2}{*}{Treat}                                     & `est_ruralarea_commtg_z' & `est_ruralarea_h_ctzpre_z' & `est_ruralarea_urate_z'                            & `est_ruralarea_treatqual_z'                                                                             & `est_ruralarea_patsat_z'                                                                              & `est_ruralarea_healthout_z'                                                                          & `est_ruralarea_mortrate_05'                                                                          \\
    tex                                                            & (`se_ruralarea_commtg_z')  & (`se_ruralarea_h_ctzpre_z')  & (`se_ruralarea_urate_z')                          & (`se_ruralarea_treatqual_z')                                                                           & (`se_ruralarea_patsat_z')                                                                              & (`se_ruralarea_healthout_z')                                                                         & (`se_ruralarea_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat*Rural}                                     & `est_tmxrural_commtg_z' & `est_tmxrural_h_ctzpre_z' & `est_tmxrural_urate_z'                            & `est_tmxrural_treatqual_z'                                                                             & `est_tmxrural_patsat_z'                                                                              & `est_tmxrural_healthout_z'                                                                          & `est_tmxrural_mortrate_05'                                                                          \\
    tex                                                            & (`se_tmxrural_commtg_z')  & (`se_tmxrural_h_ctzpre_z')  & (`se_tmxrural_urate_z')                          & (`se_tmxrural_treatqual_z')                                                                           & (`se_tmxrural_patsat_z')                                                                              & (`se_tmxrural_healthout_z')                                                                         & (`se_tmxrural_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Rural}                                     & `est_smrural_commtg_z' & `est_smrural_h_ctzpre_z' & `est_smrural_urate_z'                            & `est_smrural_treatqual_z'                                                                             & `est_smrural_patsat_z'                                                                              & `est_smrural_healthout_z'                                                                          & `est_smrural_mortrate_05'                                                                          \\
    tex                                                            & (`se_smrural_commtg_z') & (`se_smrural_h_ctzpre_z') & (`se_smrural_urate_z')                          & (`se_smrural_treatqual_z')                                                                           & (`se_smrural_patsat_z')                                                                              & (`se_smrural_healthout_z')                                                                         & (`se_smrural_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat+Treat*Rural}                         & `est_urbanarea_commtg_z' & `est_urbanarea_h_ctzpre_z'            & `est_urbanarea_urate_z'                            & `est_urbanarea_treatqual_z'                                                                             & `est_urbanarea_patsat_z'                                                                              & `est_urbanarea_healthout_z'                                                                          & `est_urbanarea_mortrate_05'                                                                          \\
    tex                                                            & (`se_urbanarea_commtg_z') & (`se_urbanarea_h_ctzpre_z') & (`se_urbanarea_urate_z')                          & (`se_urbanarea_treatqual_z')                                                                           & (`se_urbanarea_patsat_z')                                                                              & (`se_urbanarea_healthout_z')                                                                         & (`se_urbanarea_mortrate_05')                                                                         \\
	tex \midrule
	tex \multirow{2}{*}{Treat}                                     & `est_bngo_commtg_z' & `est_bngo_h_ctzpre_z' & `est_bngo_urate_z'                            & `est_bngo_treatqual_z'                                                                             & `est_bngo_patsat_z'                                                                              & `est_bngo_healthout_z'                                                                          & `est_bngo_mortrate_05'                                                                          \\
    tex                                                            & (`se_bngo_commtg_z') & (`se_bngo_h_ctzpre_z') & (`se_bngo_urate_z')                          & (`se_bngo_treatqual_z')                                                                           & (`se_bngo_patsat_z')                                                                              & (`se_bngo_healthout_z')                                                                         & (`se_bngo_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat*No health NGO present}                                     & `est_tmxngo_commtg_z' & `est_tmxngo_h_ctzpre_z' & `est_tmxngo_urate_z'                            & `est_tmxngo_treatqual_z'                                                                             & `est_tmxngo_patsat_z'                                                                              & `est_tmxngo_healthout_z'                                                                          & `est_tmxngo_mortrate_05'                                                                          \\
    tex                                                            & (`se_tmxngo_commtg_z') & (`se_tmxngo_h_ctzpre_z') & (`se_tmxngo_urate_z')                          & (`se_tmxngo_treatqual_z')                                                                           & (`se_tmxngo_patsat_z')                                                                              & (`se_tmxngo_healthout_z')                                                                         & (`se_tmxngo_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{No health NGO present}                                     & `est_smngo_commtg_z' & `est_smngo_h_ctzpre_z' & `est_smngo_urate_z'                            & `est_smngo_treatqual_z'                                                                             & `est_smngo_patsat_z'                                                                              & `est_smngo_healthout_z'                                                                          & `est_smngo_mortrate_05'                                                                          \\
    tex                                                            & (`se_smngo_commtg_z') & (`se_smngo_h_ctzpre_z')   & (`se_smngo_urate_z')                          & (`se_smngo_treatqual_z')                                                                           & (`se_smngo_patsat_z')                                                                              & (`se_smngo_healthout_z')                                                                         & (`se_smngo_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat+Treat*No health NGO present}                                     & `est_ngo_commtg_z' & `est_ngo_h_ctzpre_z' & `est_ngo_urate_z'                            & `est_ngo_treatqual_z'                                                                             & `est_ngo_patsat_z'                                                                              & `est_ngo_healthout_z'                                                                          & `est_ngo_mortrate_05'                                                                          \\
    tex                                                            & (`se_ngo_commtg_z') & (`se_ngo_h_ctzpre_z') & (`se_ngo_urate_z')                          & (`se_ngo_treatqual_z')                                                                           & (`se_ngo_patsat_z')                                                                              & (`se_ngo_healthout_z')                                                                         & (`se_ngo_mortrate_05')                                                                         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	texdoc init "${tables}/TableI23.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \scriptsize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Subgroup treatment effects on main outcomes - Community engagement hypothesis}
	tex \begin{tabular}{l*{8}{g}}
	tex \toprule
	tex                                                    					& \multicolumn{1}{c}{(1)}         & \multicolumn{1}{c}{(2)}                                                          & \multicolumn{1}{c}{(3)}                                                             & \multicolumn{1}{c}{(4)}                                                        & \multicolumn{1}{c}{(5)}   & \multicolumn{1}{c}{(6)}  & \multicolumn{1}{c}{(7)}                                                       \\
	tex 																	& \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Citizen \\ monitoring\end{tabular}}} & \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Perceived \\ citizen \\ pressure\end{tabular}}}  & \multicolumn{1}{c}{\textbf{Utilization}} & \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Treatment \\ quality\end{tabular}}} & \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Patient \\ satisfaction\end{tabular}}} & \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Health \\ outcomes\end{tabular}}} & \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Child\\ mortality\end{tabular}}} \\
	tex  \midrule
	tex \multirow{2}{*}{Treat}                                     & `est_bembed_commtg_z' & `est_bembed_h_ctzpre_z' & `est_bembed_urate_z'                            & `est_bembed_treatqual_z'                                                                             & `est_bembed_patsat_z'                                                                              & `est_bembed_healthout_z'                                                                          & `est_bembed_mortrate_05'                                                                          \\
    tex                                                            & (`se_bembed_commtg_z') & (`se_bembed_h_ctzpre_z') & (`se_bembed_urate_z')                          & (`se_bembed_treatqual_z')                                                                           & (`se_bembed_patsat_z')                                                                              & (`se_bembed_healthout_z')                                                                         & (`se_bembed_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat*High embeddedness}                                     & `est_tmxembed_commtg_z' & `est_tmxembed_h_ctzpre_z' & `est_tmxembed_urate_z'                            & `est_tmxembed_treatqual_z'                                                                             & `est_tmxembed_patsat_z'                                                                              & `est_tmxembed_healthout_z'                                                                          & `est_tmxembed_mortrate_05'                                                                          \\
    tex                                                            & (`se_tmxembed_commtg_z') & (`se_tmxembed_h_ctzpre_z') & (`se_tmxembed_urate_z')                          & (`se_tmxembed_treatqual_z')                                                                           & (`se_tmxembed_patsat_z')                                                                              & (`se_tmxembed_healthout_z')                                                                         & (`se_tmxembed_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{High embeddedness}                         & `est_smembed_commtg_z' & `est_smembed_h_ctzpre_z'            & `est_smembed_urate_z'                            & `est_smembed_treatqual_z'                                                                             & `est_smembed_patsat_z'                                                                              & `est_smembed_healthout_z'                                                                          & `est_smembed_mortrate_05'                                                                          \\
    tex                                                            & (`se_smembed_commtg_z') & (`se_smembed_h_ctzpre_z') & (`se_smembed_urate_z')                          & (`se_smembed_treatqual_z')                                                                           & (`se_smembed_patsat_z')                                                                              & (`se_smembed_healthout_z')                                                                         & (`se_smembed_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat+Treat*High embeddedness}                                     & `est_embed_commtg_z' & `est_embed_h_ctzpre_z' & `est_embed_urate_z'                            & `est_embed_treatqual_z'                                                                             & `est_embed_patsat_z'                                                                              & `est_embed_healthout_z'                                                                          & `est_embed_mortrate_05'                                                                          \\
    tex                                                            & (`se_embed_commtg_z') & (`se_embed_h_ctzpre_z') & (`se_embed_urate_z')                          & (`se_embed_treatqual_z')                                                                           & (`se_embed_patsat_z')                                                                              & (`se_embed_healthout_z')                                                                         & (`se_embed_mortrate_05')                                                                         \\
	tex \midrule
	tex \multirow{2}{*}{Treat}                                     & `est_bcap_commtg_z' & `est_bcap_h_ctzpre_z' & `est_bcap_urate_z'                            & `est_bcap_treatqual_z'                                                                             & `est_bcap_patsat_z'                                                                              & `est_bcap_healthout_z'                                                                          & `est_bcap_mortrate_05'                                                                          \\
    tex                                                            & (`se_bcap_commtg_z') & (`se_bcap_h_ctzpre_z') & (`se_bcap_urate_z')                          & (`se_bcap_treatqual_z')                                                                           & (`se_bcap_patsat_z')                                                                              & (`se_bcap_healthout_z')                                                                         & (`se_bcap_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat*High collective action potential}                                & `est_tmxcap_commtg_z' & `est_tmxcap_h_ctzpre_z'     & `est_tmxcap_urate_z'                            & `est_tmxcap_treatqual_z'                                                                             & `est_tmxcap_patsat_z'                                                                              & `est_tmxcap_healthout_z'                                                                          & `est_tmxcap_mortrate_05'                                                                          \\
    tex                                                            & (`se_tmxcap_commtg_z') & (`se_tmxcap_h_ctzpre_z') & (`se_tmxcap_urate_z')                          & (`se_tmxcap_treatqual_z')                                                                           & (`se_tmxcap_patsat_z')                                                                              & (`se_tmxcap_healthout_z')                                                                         & (`se_tmxcap_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{High collective action potential}                                     & `est_smcap_commtg_z' & `est_smcap_h_ctzpre_z' & `est_smcap_urate_z'                            & `est_smcap_treatqual_z'                                                                             & `est_smcap_patsat_z'                                                                              & `est_smcap_healthout_z'                                                                          & `est_smcap_mortrate_05'                                                                          \\
    tex                                                            & (`se_smcap_commtg_z') & (`se_smcap_h_ctzpre_z') & (`se_smcap_urate_z')                          & (`se_smcap_treatqual_z')                                                                           & (`se_smcap_patsat_z')                                                                              & (`se_smcap_healthout_z')                                                                         & (`se_smcap_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat+Treat*High collective action potential}                                     & `est_cap_commtg_z' & `est_cap_h_ctzpre_z' & `est_cap_urate_z'                            & `est_cap_treatqual_z'                                                                             & `est_cap_patsat_z'                                                                              & `est_cap_healthout_z'                                                                          & `est_cap_mortrate_05'                                                                          \\
    tex                                                            & (`se_cap_commtg_z') & (`se_cap_h_ctzpre_z') & (`se_cap_urate_z')                          & (`se_cap_treatqual_z')                                                                           & (`se_cap_patsat_z')                                                                              & (`se_cap_healthout_z')                                                                         & (`se_cap_mortrate_05')                                                                         \\
	tex \midrule
	tex \multirow{2}{*}{Treat}                                     & `est_bcommtg_commtg_z'  & `est_bcommtg_h_ctzpre_z'  & `est_bcommtg_urate_z'                            & `est_bcommtg_treatqual_z'                                                                             & `est_bcommtg_patsat_z'                                                                              & `est_bcommtg_healthout_z'                                                                          & `est_bcommtg_mortrate_05'                                                                          \\
    tex                                                            & (`se_bcommtg_commtg_z') & (`se_bcommtg_h_ctzpre_z') & (`se_bcommtg_urate_z')                          & (`se_bcommtg_treatqual_z')                                                                           & (`se_bcommtg_patsat_z')                                                                              & (`se_bcommtg_healthout_z')                                                                         & (`se_bcommtg_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat*High community monitoring}                                     & `est_tmxcommtg_commtg_z' & `est_tmxcommtg_h_ctzpre_z' & `est_tmxcommtg_urate_z'                            & `est_tmxcommtg_treatqual_z'                                                                             & `est_tmxcommtg_patsat_z'                                                                              & `est_tmxcommtg_healthout_z'                                                                          & `est_tmxcommtg_mortrate_05'                                                                          \\
    tex                                                            & (`se_tmxcommtg_commtg_z') & (`se_tmxcommtg_h_ctzpre_z') & (`se_tmxcommtg_urate_z')                          & (`se_tmxcommtg_treatqual_z')                                                                           & (`se_tmxcommtg_patsat_z')                                                                              & (`se_tmxcommtg_healthout_z')                                                                         & (`se_tmxcommtg_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{High community monitoring}                                 & `est_smcommtg_commtg_z' & `est_smcommtg_h_ctzpre_z'    & `est_smcommtg_urate_z'                            & `est_smcommtg_treatqual_z'                                                                             & `est_smcommtg_patsat_z'                                                                              & `est_smcommtg_healthout_z'                                                                          & `est_smcommtg_mortrate_05'                                                                          \\
    tex                                                            & (`se_smcommtg_commtg_z')  & (`se_smcommtg_h_ctzpre_z')  & (`se_smcommtg_urate_z')                          & (`se_smcommtg_treatqual_z')                                                                           & (`se_smcommtg_patsat_z')                                                                              & (`se_smcommtg_healthout_z')                                                                         & (`se_smcommtg_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat+Treat*High community monitoring}             & `est_commtg_commtg_z' & `est_commtg_h_ctzpre_z'                        & `est_commtg_urate_z'                            & `est_commtg_treatqual_z'                                                                             & `est_commtg_patsat_z'                                                                              & `est_commtg_healthout_z'                                                                          & `est_commtg_mortrate_05'                                                                          \\
    tex                                                            & (`se_commtg_commtg_z')  & (`se_commtg_h_ctzpre_z') & (`se_commtg_urate_z')                          & (`se_commtg_treatqual_z')                                                                           & (`se_commtg_patsat_z')                                                                              & (`se_commtg_healthout_z')                                                                         & (`se_commtg_mortrate_05')                                                                         \\
	tex \midrule
	tex \multirow{2}{*}{Treat}                                     & `est_beff_commtg_z' & `est_beff_h_ctzpre_z' & `est_beff_urate_z'                            & `est_beff_treatqual_z'                                                                             & `est_beff_patsat_z'                                                                              & `est_beff_healthout_z'                                                                          & `est_beff_mortrate_05'                                                                          \\
    tex                                                            & (`se_beff_commtg_z')  & (`se_beff_h_ctzpre_z') & (`se_beff_urate_z')                          & (`se_beff_treatqual_z')                                                                           & (`se_beff_patsat_z')                                                                              & (`se_beff_healthout_z')                                                                         & (`se_beff_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat*High efficacy}                                     & `est_tmxeff_commtg_z' & `est_tmxeff_h_ctzpre_z' & `est_tmxeff_urate_z'                            & `est_tmxeff_treatqual_z'                                                                             & `est_tmxeff_patsat_z'                                                                              & `est_tmxeff_healthout_z'                                                                          & `est_tmxeff_mortrate_05'                                                                          \\
    tex                                                            & (`se_tmxeff_commtg_z') & (`se_tmxeff_h_ctzpre_z') & (`se_tmxeff_urate_z')                          & (`se_tmxeff_treatqual_z')                                                                           & (`se_tmxeff_patsat_z')                                                                              & (`se_tmxeff_healthout_z')                                                                         & (`se_tmxeff_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{High efficacy}                                     & `est_smeff_commtg_z' & `est_smeff_h_ctzpre_z' & `est_smeff_urate_z'                            & `est_smeff_treatqual_z'                                                                             & `est_smeff_patsat_z'                                                                              & `est_smeff_healthout_z'                                                                          & `est_smeff_mortrate_05'                                                                          \\
    tex                                                            & (`se_smeff_commtg_z') & (`se_smeff_h_ctzpre_z') & (`se_smeff_urate_z')                          & (`se_smeff_treatqual_z')                                                                           & (`se_smeff_patsat_z')                                                                              & (`se_smeff_healthout_z')                                                                         & (`se_smeff_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat+Treat*High efficacy}                                     & `est_eff_commtg_z' & `est_eff_h_ctzpre_z' & `est_eff_urate_z'                            & `est_eff_treatqual_z'                                                                             & `est_eff_patsat_z'                                                                              & `est_eff_healthout_z'                                                                          & `est_eff_mortrate_05'                                                                          \\
    tex                                                            & (`se_eff_commtg_z') & (`se_eff_h_ctzpre_z') & (`se_eff_urate_z')                          & (`se_eff_treatqual_z')                                                                           & (`se_eff_patsat_z')                                                                              & (`se_eff_healthout_z')                                                                         & (`se_eff_mortrate_05')                                                                         \\
	tex \midrule
	tex \multirow{2}{*}{Treat}                                     & `est_bdistance_commtg_z' & `est_bdistance_h_ctzpre_z' & `est_bdistance_urate_z'                            & `est_bdistance_treatqual_z'                                                                             & `est_bdistance_patsat_z'                                                                              & `est_bdistance_healthout_z'                                                                          & `est_bdistance_mortrate_05'                                                                          \\
    tex                                                            & (`se_bdistance_commtg_z') & (`se_bdistance_h_ctzpre_z') & (`se_bdistance_urate_z')                          & (`se_bdistance_treatqual_z')                                                                           & (`se_bdistance_patsat_z')                                                                              & (`se_bdistance_healthout_z')                                                                         & (`se_bdistance_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat*HC near}                                     & `est_tmxdist_commtg_z' & `est_tmxdist_h_ctzpre_z' & `est_tmxdist_urate_z'                            & `est_tmxdist_treatqual_z'                                                                             & `est_tmxdist_patsat_z'                                                                              & `est_tmxdist_healthout_z'                                                                          & `est_tmxdist_mortrate_05'                                                                          \\
    tex                                                            & (`se_tmxdist_commtg_z')  & (`se_tmxdist_h_ctzpre_z')  & (`se_tmxdist_urate_z')                          & (`se_tmxdist_treatqual_z')                                                                           & (`se_tmxdist_patsat_z')                                                                              & (`se_tmxdist_healthout_z')                                                                         & (`se_tmxdist_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{HC near}                                     & `est_smdist_commtg_z' & `est_smdist_h_ctzpre_z' & `est_smdist_urate_z'                            & `est_smdist_treatqual_z'                                                                             & `est_smdist_patsat_z'                                                                              & `est_smdist_healthout_z'                                                                          & `est_smdist_mortrate_05'                                                                          \\
    tex                                                            & (`se_smdist_commtg_z') & (`se_smdist_h_ctzpre_z') & (`se_smdist_urate_z')                          & (`se_smdist_treatqual_z')                                                                           & (`se_smdist_patsat_z')                                                                              & (`se_smdist_healthout_z')                                                                         & (`se_smdist_mortrate_05')                                                                         \\
	tex \multirow{2}{*}{Treat+Treat*HC near}                                     & `est_distance_commtg_z' & `est_distance_h_ctzpre_z' & `est_distance_urate_z'                            & `est_distance_treatqual_z'                                                                             & `est_distance_patsat_z'                                                                              & `est_distance_healthout_z'                                                                          & `est_distance_mortrate_05'                                                                          \\
    tex                                                            & (`se_distance_commtg_z')  & (`se_distance_h_ctzpre_z')  & (`se_distance_urate_z')                          & (`se_distance_treatqual_z')                                                                           & (`se_distance_patsat_z')                                                                              & (`se_distance_healthout_z')                                                                         & (`se_distance_mortrate_05')                                                                         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	*************************************************************************************************************************************
	* Table I24: Estimated treatment effects on treatment quality, by baseline level of development in the health center catchment area *
	*************************************************************************************************************************************
	
	texdoc init "${tables}/TableI24.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \scriptsize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Estimated treatment effects on treatment quality, by baseline level of development in the health center catchment area}
	tex \begin{tabular}{lllllll}
	tex \toprule
	tex \multicolumn{2}{c}{Less developed}   &  & \multicolumn{2}{c}{More developed Subgroup} & &  \\ \cline{1-2} \cline{4-5}
	tex Subgroup                       & ATE &  & Subgroup                            & ATE   & Difference Significant  \\ \cline{1-5}
	tex HC2                            & `est_hc2_treatqual_z'    &  & HC3                                 & `est_hc3_treatqual_z'      & no  \\
	tex Low BL TQ                      &  `est_treatqual_treatqual_z'   &  & High BL TQ                          &  `est_btreatqual_treatqual_z'     & no \\
	tex Few alternative options &  `est_outside_treatqual_z'   &  & Many alternative options    &  `est_boutside_treatqual_z'     & no \\
	tex HC Far &  `est_bdistance_treatqual_z'   &  & HC Near    &  `est_distance_treatqual_z'     & no \\
	tex Rural                          &  `est_urbanarea_treatqual_z'   &  & Urban                               &  `est_ruralarea_treatqual_z'     & yes \\
	tex No health NGO present          &  `est_ngo_treatqual_z'  &  & Health NGO present                  &  `est_bngo_treatqual_z'     &  no \\
	tex High BL U5MR                   &  `est_u5m_treatqual_z'   &  & Low BL U5MR                         &  `est_bu5m_treatqual_z'     &  no \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	*****************************************************************************
	* Table H25: Subgroup effects on child mortality by baseline mortality rate *
	*****************************************************************************
	
	* Running subgroup analyse by position toward child mortality
	
	use "${usedata}/u5mortality_ctrls.dta", clear
	
	* We calculate the threshold
	
	sum u5mortality if treatment == 0
	
	local threshold_low = `r(mean)' - `r(sd)'
	local threshold_high = `r(mean)' + `r(sd)'
		
	use "${usedata}/baseline_U5M.dta", clear
	
	* We calculate the sample that corresponds to ACT Health HCs with same starting condition than P2P
	
	gen u5_p2p = (b_u5mortality >= `threshold_low' & b_u5mortality <= `threshold_high' )
	
	* The median should be considered at 58th otherwise it is 0
	* 58th pctile
	
	egen u5m_58 = pctile(b_u5mortality), p(58.25)
	gen u5_b58 = (b_u5mortality >= u5m_58)
	
	* 66th pctile
	
	egen u5m_66 = pctile(b_u5mortality), p(66)
	gen u5_b66 = (b_u5mortality >= u5m_66)
	
	* 75th pctile
	
	egen u5m_75 = pctile(b_u5mortality), p(75)
	gen u5_b75 = (b_u5mortality >= u5m_75)
	
	* 90th pctile
	
	egen u5m_90 = pctile(b_u5mortality), p(90)
	gen u5_b90 = (b_u5mortality >= u5m_90)
	
	keep hc_id u5_*
	
	tempfile bu5m
	sa "`bu5m'"
	
	* We now run the subgroup analysis for each components

	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* We merge the different indices
	
	merge m:1 hc_id using "`bu5m'"
	
	* We will create the interaction terms
	
	foreach var in u5_b58 u5_b66 u5_b75 u5_b90 {
	
		gen treatfull_`var' = treatfull * `var'
		la var treatfull_`var' "treatfull * `var'"
		
		}
	
	* We create it for endline and bline and one only irrespective to the timeline
	
	local indices_hc mortrate_05
	
	* We create for each level
	
	* Subgroup Effects: 58th percentile
	
	foreach x in `indices_hc' {
	
		areg e_`x' treatfull treatfull_u5_b58 u5_b58 b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_u5_b58
		local n_bu5_b58_`x' = string(e(N),"%9.0fc")
		local r2_bu5_b58_`x' = string(e(r2),"%9.3fc")

		lincom treatfull + treatfull_u5_b58 
		local est_u5_b58_`x' = r(estimate)
		local se_u5_b58_`x' = r(se)
		test treatfull + treatfull_u5_b58 = 0
		local p_u5_b58_`x' = r(p)
		
		local est_bu5_b58_`x' = string(_b[treatfull],"%9.3fc")
		local se_bu5_b58_`x' = string(_se[treatfull],"%9.3fc")
		local p_bu5_b58_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxbu5_b58_`x' = string(_b[treatfull_u5_b58],"%9.3fc")
		local se_tmxbu5_b58_`x' = string(_se[treatfull_u5_b58],"%9.3fc")
		local p_tmxbu5_b58_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_u5_b58]/_se[treatfull_u5_b58])))
		
		local est_smbu5_b58_`x' = string(_b[u5_b58],"%9.3fc")
		local se_smbu5_b58_`x' = string(_se[u5_b58],"%9.3fc")
		local p_smbu5_b58_`x' = (2 * ttail(e(df_r), abs(_b[u5_b58]/_se[u5_b58])))
		
		local est_cbu5_b58_`x' = string(_b[_cons],"%9.3fc")
		local se_cbu5_b58_`x' = string(_se[_cons],"%9.3fc")
		local p_cbu5_b58_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bu5_b58 tmxbu5_b58 smbu5_b58 cbu5_b58 {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			

			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
		
		gen sign_u5_b58_zero_`x' = (`p_u5_b58_`x''>0.1)
		gen sign_u5_b58_p1s_`x' = (`p_u5_b58_`x''<=0.1 & `p_u5_b58_`x''>0.05 & `est_u5_b58_`x''>0)
		gen sign_u5_b58_p2s_`x' = (`p_u5_b58_`x''<=0.05 & `p_u5_b58_`x''>0.01 & `est_u5_b58_`x''>0)
		gen sign_u5_b58_p3s_`x' = (`p_u5_b58_`x''<=0.01 & `p_u5_b58_`x''>=0 & `est_u5_b58_`x''>0)
		gen sign_u5_b58_m1s_`x' = (`p_u5_b58_`x''<=0.1 & `p_u5_b58_`x''>0.05 & `est_u5_b58_`x''<0)
		gen sign_u5_b58_m2s_`x' = (`p_u5_b58_`x''<=0.05 & `p_u5_b58_`x''>0.01 & `est_u5_b58_`x''<0)
		gen sign_u5_b58_m3s_`x' = (`p_u5_b58_`x''<=0.01 & `p_u5_b58_`x''>=0 & `est_u5_b58_`x''<0)
		
		local p_u5_b58_`x' = string(`p_u5_b58_`x'',"%9.3fc")
		local est_u5_b58_`x' = string(`est_u5_b58_`x'',"%9.3fc")
		local se_u5_b58_`x' = string(`se_u5_b58_`x'',"%9.3fc")
		
		if sign_u5_b58_p1s_`x' == 1 {
				local sign_u5_b58_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_u5_b58_`x' = "`est_u5_b58_`x''*"
				}
				
		if sign_u5_b58_p2s_`x' == 1 {	
				local sign_u5_b58_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_u5_b58_`x' = "`est_u5_b58_`x''**"
				}
				
		if sign_u5_b58_p3s_`x' == 1 {	
				local sign_u5_b58_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_u5_b58_`x' = "`est_u5_b58_`x''***"
				}
			
		if sign_u5_b58_m1s_`x' == 1 {
				local sign_u5_b58_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_u5_b58_`x' = "`est_u5_b58_`x''*"
				}
				
		if sign_u5_b58_m2s_`x' == 1 {	
				local sign_u5_b58_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_u5_b58_`x' = "`est_u5_b58_`x''**"
				}
				
		if sign_u5_b58_m3s_`x' == 1 {	
				local sign_u5_b58_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_u5_b58_`x' = "`est_u5_b58_`x''***"
				}
			
		if sign_u5_b58_zero_`x' == 1 {
			local sign_u5_b58_`x' = "0"
			}
		
		drop sign_*

		}
		
	* Subgroup Effects: 66th percentile
	
	foreach x in `indices_hc' {
	
		areg e_`x' treatfull treatfull_u5_b66 u5_b66 b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_u5_b66
		local n_bu5_b66_`x' = string(e(N),"%9.0fc")
		local r2_bu5_b66_`x' = string(e(r2),"%9.3fc")

		lincom treatfull + treatfull_u5_b66 
		local est_u5_b66_`x' = r(estimate)
		local se_u5_b66_`x' = r(se)
		test treatfull + treatfull_u5_b66 = 0
		local p_u5_b66_`x' = r(p)
		
		local est_bu5_b66_`x' = string(_b[treatfull],"%9.3fc")
		local se_bu5_b66_`x' = string(_se[treatfull],"%9.3fc")
		local p_bu5_b66_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxbu5_b66_`x' = string(_b[treatfull_u5_b66],"%9.3fc")
		local se_tmxbu5_b66_`x' = string(_se[treatfull_u5_b66],"%9.3fc")
		local p_tmxbu5_b66_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_u5_b66]/_se[treatfull_u5_b66])))
		
		local est_smbu5_b66_`x' = string(_b[u5_b66],"%9.3fc")
		local se_smbu5_b66_`x' = string(_se[u5_b66],"%9.3fc")
		local p_smbu5_b66_`x' = (2 * ttail(e(df_r), abs(_b[u5_b66]/_se[u5_b66])))
		
		local est_cbu5_b66_`x' = string(_b[_cons],"%9.3fc")
		local se_cbu5_b66_`x' = string(_se[_cons],"%9.3fc")
		local p_cbu5_b66_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bu5_b66 tmxbu5_b66 smbu5_b66 cbu5_b66 {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			

			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
		
		gen sign_u5_b66_zero_`x' = (`p_u5_b66_`x''>0.1)
		gen sign_u5_b66_p1s_`x' = (`p_u5_b66_`x''<=0.1 & `p_u5_b66_`x''>0.05 & `est_u5_b66_`x''>0)
		gen sign_u5_b66_p2s_`x' = (`p_u5_b66_`x''<=0.05 & `p_u5_b66_`x''>0.01 & `est_u5_b66_`x''>0)
		gen sign_u5_b66_p3s_`x' = (`p_u5_b66_`x''<=0.01 & `p_u5_b66_`x''>=0 & `est_u5_b66_`x''>0)
		gen sign_u5_b66_m1s_`x' = (`p_u5_b66_`x''<=0.1 & `p_u5_b66_`x''>0.05 & `est_u5_b66_`x''<0)
		gen sign_u5_b66_m2s_`x' = (`p_u5_b66_`x''<=0.05 & `p_u5_b66_`x''>0.01 & `est_u5_b66_`x''<0)
		gen sign_u5_b66_m3s_`x' = (`p_u5_b66_`x''<=0.01 & `p_u5_b66_`x''>=0 & `est_u5_b66_`x''<0)
		
		local p_u5_b66_`x' = string(`p_u5_b66_`x'',"%9.3fc")
		local est_u5_b66_`x' = string(`est_u5_b66_`x'',"%9.3fc")
		local se_u5_b66_`x' = string(`se_u5_b66_`x'',"%9.3fc")
		
		if sign_u5_b66_p1s_`x' == 1 {
				local sign_u5_b66_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_u5_b66_`x' = "`est_u5_b66_`x''*"
				}
				
		if sign_u5_b66_p2s_`x' == 1 {	
				local sign_u5_b66_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_u5_b66_`x' = "`est_u5_b66_`x''**"
				}
				
		if sign_u5_b66_p3s_`x' == 1 {	
				local sign_u5_b66_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_u5_b66_`x' = "`est_u5_b66_`x''***"
				}
			
		if sign_u5_b66_m1s_`x' == 1 {
				local sign_u5_b66_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_u5_b66_`x' = "`est_u5_b66_`x''*"
				}
				
		if sign_u5_b66_m2s_`x' == 1 {	
				local sign_u5_b66_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_u5_b66_`x' = "`est_u5_b66_`x''**"
				}
				
		if sign_u5_b66_m3s_`x' == 1 {	
				local sign_u5_b66_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_u5_b66_`x' = "`est_u5_b66_`x''***"
				}
			
		if sign_u5_b66_zero_`x' == 1 {
			local sign_u5_b66_`x' = "0"
			}
		
		drop sign_*

		}
		
	* Subgroup Effects: 75th percentile
	
	foreach x in `indices_hc' {
	
		areg e_`x' treatfull treatfull_u5_b75 u5_b75 b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_u5_b75
		local n_bu5_b75_`x' = string(e(N),"%9.0fc")
		local r2_bu5_b75_`x' = string(e(r2),"%9.3fc")

		lincom treatfull + treatfull_u5_b75 
		local est_u5_b75_`x' = r(estimate)
		local se_u5_b75_`x' = r(se)
		test treatfull + treatfull_u5_b75 = 0
		local p_u5_b75_`x' = r(p)
		
		local est_bu5_b75_`x' = string(_b[treatfull],"%9.3fc")
		local se_bu5_b75_`x' = string(_se[treatfull],"%9.3fc")
		local p_bu5_b75_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxbu5_b75_`x' = string(_b[treatfull_u5_b75],"%9.3fc")
		local se_tmxbu5_b75_`x' = string(_se[treatfull_u5_b75],"%9.3fc")
		local p_tmxbu5_b75_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_u5_b75]/_se[treatfull_u5_b75])))
		
		local est_smbu5_b75_`x' = string(_b[u5_b75],"%9.3fc")
		local se_smbu5_b75_`x' = string(_se[u5_b75],"%9.3fc")
		local p_smbu5_b75_`x' = (2 * ttail(e(df_r), abs(_b[u5_b75]/_se[u5_b75])))
		
		local est_cbu5_b75_`x' = string(_b[_cons],"%9.3fc")
		local se_cbu5_b75_`x' = string(_se[_cons],"%9.3fc")
		local p_cbu5_b75_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bu5_b75 tmxbu5_b75 smbu5_b75 cbu5_b75 {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			

			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
		
		gen sign_u5_b75_zero_`x' = (`p_u5_b75_`x''>0.1)
		gen sign_u5_b75_p1s_`x' = (`p_u5_b75_`x''<=0.1 & `p_u5_b75_`x''>0.05 & `est_u5_b75_`x''>0)
		gen sign_u5_b75_p2s_`x' = (`p_u5_b75_`x''<=0.05 & `p_u5_b75_`x''>0.01 & `est_u5_b75_`x''>0)
		gen sign_u5_b75_p3s_`x' = (`p_u5_b75_`x''<=0.01 & `p_u5_b75_`x''>=0 & `est_u5_b75_`x''>0)
		gen sign_u5_b75_m1s_`x' = (`p_u5_b75_`x''<=0.1 & `p_u5_b75_`x''>0.05 & `est_u5_b75_`x''<0)
		gen sign_u5_b75_m2s_`x' = (`p_u5_b75_`x''<=0.05 & `p_u5_b75_`x''>0.01 & `est_u5_b75_`x''<0)
		gen sign_u5_b75_m3s_`x' = (`p_u5_b75_`x''<=0.01 & `p_u5_b75_`x''>=0 & `est_u5_b75_`x''<0)
		
		local p_u5_b75_`x' = string(`p_u5_b75_`x'',"%9.3fc")
		local est_u5_b75_`x' = string(`est_u5_b75_`x'',"%9.3fc")
		local se_u5_b75_`x' = string(`se_u5_b75_`x'',"%9.3fc")
		
		if sign_u5_b75_p1s_`x' == 1 {
				local sign_u5_b75_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_u5_b75_`x' = "`est_u5_b75_`x''*"
				}
				
		if sign_u5_b75_p2s_`x' == 1 {	
				local sign_u5_b75_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_u5_b75_`x' = "`est_u5_b75_`x''**"
				}
				
		if sign_u5_b75_p3s_`x' == 1 {	
				local sign_u5_b75_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_u5_b75_`x' = "`est_u5_b75_`x''***"
				}
			
		if sign_u5_b75_m1s_`x' == 1 {
				local sign_u5_b75_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_u5_b75_`x' = "`est_u5_b75_`x''*"
				}
				
		if sign_u5_b75_m2s_`x' == 1 {	
				local sign_u5_b75_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_u5_b75_`x' = "`est_u5_b75_`x''**"
				}
				
		if sign_u5_b75_m3s_`x' == 1 {	
				local sign_u5_b75_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_u5_b75_`x' = "`est_u5_b75_`x''***"
				}
			
		if sign_u5_b75_zero_`x' == 1 {
			local sign_u5_b75_`x' = "0"
			}
		
		drop sign_*

		}
		
	* Subgroup Effects: 90th percentile
	
	foreach x in `indices_hc' {
	
		areg e_`x' treatfull treatfull_u5_b90 u5_b90 b_`x' `e_controls_tfull_hc' `treatfull_hc_int_e_controls' if uniquehc == 1, robust a(district)
		eststo e_`x'_u5_b90
		local n_bu5_b90_`x' = string(e(N),"%9.0fc")
		local r2_bu5_b90_`x' = string(e(r2),"%9.3fc")

		lincom treatfull + treatfull_u5_b90 
		local est_u5_b90_`x' = r(estimate)
		local se_u5_b90_`x' = r(se)
		test treatfull + treatfull_u5_b90 = 0
		local p_u5_b90_`x' = r(p)
		
		local est_bu5_b90_`x' = string(_b[treatfull],"%9.3fc")
		local se_bu5_b90_`x' = string(_se[treatfull],"%9.3fc")
		local p_bu5_b90_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
		
		local est_tmxbu5_b90_`x' = string(_b[treatfull_u5_b90],"%9.3fc")
		local se_tmxbu5_b90_`x' = string(_se[treatfull_u5_b90],"%9.3fc")
		local p_tmxbu5_b90_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_u5_b90]/_se[treatfull_u5_b90])))
		
		local est_smbu5_b90_`x' = string(_b[u5_b90],"%9.3fc")
		local se_smbu5_b90_`x' = string(_se[u5_b90],"%9.3fc")
		local p_smbu5_b90_`x' = (2 * ttail(e(df_r), abs(_b[u5_b90]/_se[u5_b90])))
		
		local est_cbu5_b90_`x' = string(_b[_cons],"%9.3fc")
		local se_cbu5_b90_`x' = string(_se[_cons],"%9.3fc")
		local p_cbu5_b90_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		foreach var in bu5_b90 tmxbu5_b90 smbu5_b90 cbu5_b90 {
		
			gen sign_`var'_zero_`x' = (`p_`var'_`x''>0.1)
			gen sign_`var'_p1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''>0)
			gen sign_`var'_p2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''>0)
			gen sign_`var'_p3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''>0)
			gen sign_`var'_m1s_`x' = (`p_`var'_`x''<=0.1 & `p_`var'_`x''>0.05 & `est_`var'_`x''<0)
			gen sign_`var'_m2s_`x' = (`p_`var'_`x''<=0.05 & `p_`var'_`x''>0.01 & `est_`var'_`x''<0)
			gen sign_`var'_m3s_`x' = (`p_`var'_`x''<=0.01 & `p_`var'_`x''>=0 & `est_`var'_`x''<0)
			

			if sign_`var'_p1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}+"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_p2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}+"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_p3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}+"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_m1s_`x' == 1 {
					local sign_`var'_`x' = "\cellcolor[HTML]{EFEFEF}-"
					local est_`var'_`x' = "`est_`var'_`x''*"
					}
					
			if sign_`var'_m2s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{C0C0C0}-"
					local est_`var'_`x' = "`est_`var'_`x''**"
					}
					
			if sign_`var'_m3s_`x' == 1 {	
					local sign_`var'_`x' = "\cellcolor[HTML]{9B9B9B}-"
					local est_`var'_`x' = "`est_`var'_`x''***"
					}
				
			if sign_`var'_zero_`x' == 1 {
				local sign_`var'_`x' = "0"
				}
				
			}
		
		gen sign_u5_b90_zero_`x' = (`p_u5_b90_`x''>0.1)
		gen sign_u5_b90_p1s_`x' = (`p_u5_b90_`x''<=0.1 & `p_u5_b90_`x''>0.05 & `est_u5_b90_`x''>0)
		gen sign_u5_b90_p2s_`x' = (`p_u5_b90_`x''<=0.05 & `p_u5_b90_`x''>0.01 & `est_u5_b90_`x''>0)
		gen sign_u5_b90_p3s_`x' = (`p_u5_b90_`x''<=0.01 & `p_u5_b90_`x''>=0 & `est_u5_b90_`x''>0)
		gen sign_u5_b90_m1s_`x' = (`p_u5_b90_`x''<=0.1 & `p_u5_b90_`x''>0.05 & `est_u5_b90_`x''<0)
		gen sign_u5_b90_m2s_`x' = (`p_u5_b90_`x''<=0.05 & `p_u5_b90_`x''>0.01 & `est_u5_b90_`x''<0)
		gen sign_u5_b90_m3s_`x' = (`p_u5_b90_`x''<=0.01 & `p_u5_b90_`x''>=0 & `est_u5_b90_`x''<0)
		
		local p_u5_b90_`x' = string(`p_u5_b90_`x'',"%9.3fc")
		local est_u5_b90_`x' = string(`est_u5_b90_`x'',"%9.3fc")
		local se_u5_b90_`x' = string(`se_u5_b90_`x'',"%9.3fc")
		
		if sign_u5_b90_p1s_`x' == 1 {
				local sign_u5_b90_`x' = "\cellcolor[HTML]{EFEFEF}+"
				local est_u5_b90_`x' = "`est_u5_b90_`x''*"
				}
				
		if sign_u5_b90_p2s_`x' == 1 {	
				local sign_u5_b90_`x' = "\cellcolor[HTML]{C0C0C0}+"
				local est_u5_b90_`x' = "`est_u5_b90_`x''**"
				}
				
		if sign_u5_b90_p3s_`x' == 1 {	
				local sign_u5_b90_`x' = "\cellcolor[HTML]{9B9B9B}+"
				local est_u5_b90_`x' = "`est_u5_b90_`x''***"
				}
			
		if sign_u5_b90_m1s_`x' == 1 {
				local sign_u5_b90_`x' = "\cellcolor[HTML]{EFEFEF}-"
				local est_u5_b90_`x' = "`est_u5_b90_`x''*"
				}
				
		if sign_u5_b90_m2s_`x' == 1 {	
				local sign_u5_b90_`x' = "\cellcolor[HTML]{C0C0C0}-"
				local est_u5_b90_`x' = "`est_u5_b90_`x''**"
				}
				
		if sign_u5_b90_m3s_`x' == 1 {	
				local sign_u5_b90_`x' = "\cellcolor[HTML]{9B9B9B}-"
				local est_u5_b90_`x' = "`est_u5_b90_`x''***"
				}
			
		if sign_u5_b90_zero_`x' == 1 {
			local sign_u5_b90_`x' = "0"
			}
		
		drop sign_*

		}
	
	* We outsheet the results
	
	texdoc init "${tables}/TableI25.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Subgroup effects on child mortality by baseline mortality rate }
	tex \begin{tabular}{lgggg}
	tex \toprule
	tex 										  & (1)                       & (2)                                                          & (3)                                                             & (4)                                                                              \\
	tex \multirow{-2}{*}{}                             & \textbf{58th}      & \textbf{\begin{tabular}[c]{@{}c@{}}66th\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}75th\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}90th\end{tabular}}        \\
	tex \midrule
	tex \multirow{2}{*}{Treat}  & `est_bu5_b58_mortrate_05'           & `est_bu5_b66_mortrate_05'                                                            & `est_bu5_b75_mortrate_05'                                                                &    `est_bu5_b90_mortrate_05'                                                                \\
	tex  & (`se_bu5_b58_mortrate_05' )           & (`se_bu5_b66_mortrate_05')                                                            & (`se_bu5_b75_mortrate_05')                                                               &     (`se_bu5_b90_mortrate_05')                                                            \\
	tex \multirow{2}{*}{Treat * U5MR above xxth percentile}  & `est_tmxbu5_b58_mortrate_05'           & `est_tmxbu5_b66_mortrate_05'                                                            & `est_tmxbu5_b75_mortrate_05'                                                                &    `est_tmxbu5_b90_mortrate_05'                                                                \\
	tex  & (`se_tmxbu5_b58_mortrate_05' )           & (`se_tmxbu5_b66_mortrate_05')                                                            & (`se_tmxbu5_b75_mortrate_05')                                                               &     (`se_tmxbu5_b90_mortrate_05')                                                            \\
	tex \multirow{2}{*}{U5MR above xxth percentile}  & `est_smbu5_b58_mortrate_05'           & `est_smbu5_b66_mortrate_05'                                                            & `est_smbu5_b75_mortrate_05'                                                                &    `est_smbu5_b90_mortrate_05'                                                                \\
	tex  & (`se_smbu5_b58_mortrate_05' )           & (`se_smbu5_b66_mortrate_05')                                                            & (`se_smbu5_b75_mortrate_05')                                                               &     (`se_smbu5_b90_mortrate_05')                                                            \\
	tex \multirow{2}{*}{Treat + Treat * U5MR above xxth percentile}  & `est_u5_b58_mortrate_05'           & `est_u5_b66_mortrate_05'                                                            & `est_u5_b75_mortrate_05'                                                                &    `est_u5_b90_mortrate_05'                                                                \\
	tex  & (`se_u5_b58_mortrate_05' )           & (`se_u5_b66_mortrate_05')                                                            & (`se_u5_b75_mortrate_05')                                                               &     (`se_u5_b90_mortrate_05')                                                            \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	

	****************************************************************************
	* Table I26: By Presidential vote share above or below the national median *
	****************************************************************************
	
	local var treatfull
	
	* We load the dataset. This is the light version
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	local indices urate_z treatqual_z patsat_z commtg_z
	local indices_ho healthout_z
	local indices_hc mortrate_05 h_ctzpressure_z

	* At endline:
	
	local y = 1
	foreach x in `indices' {
		areg  e_`x' `var' treatfull_votshare_nat b_above_natmed_nrmpres b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		estimates store me`y'
		
		local n_1e_`x' = string(`e(N)',"%9.0fc")
		local r2_1e_`x' = string(`e(r2)',"%9.3fc")
		local est_1e_`x' = string(_b[`var'],"%9.3fc")
		local se_1e_`x' = string(_se[`var'],"%9.3fc")
		local p_1e_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		local p_`y'e = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1e_1s_`x' = (`p_1e_`x''<=0.1 & `p_1e_`x''>0.05)
		gen s_1e_2s_`x' = (`p_1e_`x''<=0.05 & `p_1e_`x''>0.01)
		gen s_1e_3s_`x' = (`p_1e_`x''<=0.01 & `p_1e_`x''>=0)
	
		if s_1e_1s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''*"
				}
				
		if s_1e_2s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''**"
				}
				
		if s_1e_3s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''***"
				}
		
		local est_2e_`x' = string(_b[_cons],"%9.3fc")
		local se_2e_`x' = string(_se[_cons],"%9.3fc")
		local p_2e_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_2e_1s_`x' = (`p_2e_`x''<=0.1 & `p_2e_`x''>0.05)
		gen s_2e_2s_`x' = (`p_2e_`x''<=0.05 & `p_2e_`x''>0.01)
		gen s_2e_3s_`x' = (`p_2e_`x''<=0.01 & `p_2e_`x''>=0)
	
		if s_2e_1s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''*"
				}
				
		if s_2e_2s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''**"
				}
				
		if s_2e_3s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''***"
				}
				
		local est_3e_`x' = string(_b[treatfull_votshare_nat],"%9.3fc")
		local se_3e_`x' = string(_se[treatfull_votshare_nat],"%9.3fc")
		local p_3e_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_votshare_nat]/_se[treatfull_votshare_nat])))
		
		gen s_3e_1s_`x' = (`p_3e_`x''<=0.1 & `p_3e_`x''>0.05)
		gen s_3e_2s_`x' = (`p_3e_`x''<=0.05 & `p_3e_`x''>0.01)
		gen s_3e_3s_`x' = (`p_3e_`x''<=0.01 & `p_3e_`x''>=0)
	
		if s_3e_1s_`x' == 1 {
				local est_3e_`x' = "`est_3e_`x''*"
				}
				
		if s_3e_2s_`x' == 1 {
				local est_3e_`x' = "`est_3e_`x''**"
				}
				
		if s_3e_3s_`x' == 1 {
				local est_3e_`x' = "`est_3e_`x''***"
				}
				
		test treatfull = 0
		local f_walde_`x' = string(`r(p)',"%9.3fc")
		
		lincom treatfull + treatfull_votshare_nat
		local est_4_`x' = string(`r(estimate)',"%9.3fc")
		local se_4_`x' = string(`r(se)',"%9.3fc")
		local se_4_`x' = "`se_4_`x''"
		test treatfull + treatfull_votshare_nat = 0
		local p_4_`x' = string(`r(p)',"%9.3fc")
		
					
		local y = `y' + 1
		}
	

	********************
	* Individual level *
	********************
	
	* Health outcome

	* At endline
	
	use "${usedata}/healthoutcome_endline_ind.dta", clear
	
	***************
	* Regressions *
	***************

	local var treatfull
	
	areg  e_healthoutcome_z treatfull treatfull_votshare_nat b_above_natmed_nrmpres b_healthoutcome_z b_healthoutcome_z_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district) 
	
		estimates store me6
		
		local n_1e_healthout_z = string(`e(N)',"%9.0fc")
		local r2_1e_healthout_z = string(`e(r2)',"%9.3fc")
		local est_1e_healthout_z = string(_b[`var'],"%9.3fc")
		local se_1e_healthout_z = string(_se[`var'],"%9.3fc")
		local p_1e_healthout_z = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		local p_6e = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1e_1s_healthout_z = (`p_1e_healthout_z'<=0.1 & `p_1e_healthout_z'>0.05)
		gen s_1e_2s_healthout_z = (`p_1e_healthout_z'<=0.05 & `p_1e_healthout_z'>0.01)
		gen s_1e_3s_healthout_z = (`p_1e_healthout_z'<=0.01 & `p_1e_healthout_z'>=0)
	
		if s_1e_1s_healthout_z == 1 {
				local est_1e_healthout_z = "`est_1e_healthout_z'*"
				}
				
		if s_1e_2s_healthout_z == 1 {
				local est_1e_healthout_z = "`est_1e_healthout_z'**"
				}
				
		if s_1e_3s_healthout_z == 1 {
				local est_1e_healthout_z = "`est_1e_healthout_z'***"
				}
		
		local est_2e_healthout_z = string(_b[_cons],"%9.3fc")
		local se_2e_healthout_z = string(_se[_cons],"%9.3fc")
		local p_2e_healthout_z = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_2e_1s_healthout_z = (`p_2e_healthout_z'<=0.1 & `p_2e_healthout_z'>0.05)
		gen s_2e_2s_healthout_z = (`p_2e_healthout_z'<=0.05 & `p_2e_healthout_z'>0.01)
		gen s_2e_3s_healthout_z = (`p_2e_healthout_z'<=0.01 & `p_2e_healthout_z'>=0)
	
		if s_2e_1s_healthout_z == 1 {
				local est_2e_healthout_z = "`est_2e_healthout_z'*"
				}
				
		if s_2e_2s_healthout_z == 1 {
				local est_2e_healthout_z = "`est_2e_healthout_z'**"
				}
				
		if s_2e_3s_healthout_z == 1 {
				local est_2e_healthout_z = "`est_2e_healthout_z'***"
				}
				
		local est_3e_healthout_z = string(_b[treatfull_votshare_nat],"%9.3fc")
		local se_3e_healthout_z = string(_se[treatfull_votshare_nat],"%9.3fc")
		local p_3e_healthout_z = (2 * ttail(e(df_r), abs(_b[treatfull_votshare_nat]/_se[treatfull_votshare_nat])))
		
		gen s_3e_1s_healthout_z = (`p_3e_healthout_z'<=0.1 & `p_3e_healthout_z'>0.05)
		gen s_3e_2s_healthout_z = (`p_3e_healthout_z'<=0.05 & `p_3e_healthout_z'>0.01)
		gen s_3e_3s_healthout_z = (`p_3e_healthout_z'<=0.01 & `p_3e_healthout_z'>=0)
	
		if s_3e_1s_healthout_z == 1 {
				local est_3e_`x' = "`est_3e_healthout_z'*"
				}
				
		if s_3e_2s_healthout_z == 1 {
				local est_3e_`x' = "`est_3e_healthout_z'**"
				}
				
		if s_3e_3s_healthout_z == 1 {
				local est_3e_`x' = "`est_3e_healthout_z'***"
				}
				
				
		test treatfull = 0
		local f_walde_healthout_z = string(`r(p)',"%9.3fc")
		
		lincom treatfull + treatfull_votshare_nat
		local est_4_healthout_z = string(`r(estimate)',"%9.3fc")
		local se_4_healthout_z = string(`r(se)',"%9.3fc")
		local se_4_healthout_z = "`se_4_healthout_z'"
		test treatfull + treatfull_votshare_nat = 0
		local p_4_healthout_z = string(`r(p)',"%9.3fc")
		
		
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	local indices_hc mortrate_05 h_ctzpressure_z
	
	* Mortrate HC level (endline)
	
	local y = 7
	foreach x in `indices_hc' {
		areg  e_`x' `var' treatfull_votshare_nat b_above_natmed_nrmpres b_`x' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		estimates store me`y'
		
		local n_1e_`x' = string(`e(N)',"%9.0fc")
		local r2_1e_`x' = string(`e(r2)',"%9.3fc")
		local est_1e_`x' = string(_b[`var'],"%9.3fc")
		local se_1e_`x' = string(_se[`var'],"%9.3fc")
		local p_1e_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		local p_`y'e = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1e_1s_`x' = (`p_1e_`x''<=0.1 & `p_1e_`x''>0.05)
		gen s_1e_2s_`x' = (`p_1e_`x''<=0.05 & `p_1e_`x''>0.01)
		gen s_1e_3s_`x' = (`p_1e_`x''<=0.01 & `p_1e_`x''>=0)
	
		if s_1e_1s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''*"
				}
				
		if s_1e_2s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''**"
				}
				
		if s_1e_3s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''***"
				}
		
		local est_2e_`x' = string(_b[_cons],"%9.3fc")
		local se_2e_`x' = string(_se[_cons],"%9.3fc")
		local p_2e_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_2e_1s_`x' = (`p_2e_`x''<=0.1 & `p_2e_`x''>0.05)
		gen s_2e_2s_`x' = (`p_2e_`x''<=0.05 & `p_2e_`x''>0.01)
		gen s_2e_3s_`x' = (`p_2e_`x''<=0.01 & `p_2e_`x''>=0)
	
		if s_2e_1s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''*"
				}
				
		if s_2e_2s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''**"
				}
				
		if s_2e_3s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''***"
				}
				
		local est_3e_`x' = string(_b[treatfull_votshare_nat],"%9.3fc")
		local se_3e_`x' = string(_se[treatfull_votshare_nat],"%9.3fc")
		local p_3e_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_votshare_nat]/_se[treatfull_votshare_nat])))
		
		gen s_3e_1s_`x' = (`p_3e_`x''<=0.1 & `p_3e_`x''>0.05)
		gen s_3e_2s_`x' = (`p_3e_`x''<=0.05 & `p_3e_`x''>0.01)
		gen s_3e_3s_`x' = (`p_3e_`x''<=0.01 & `p_3e_`x''>=0)
	
		if s_3e_1s_`x' == 1 {
				local est_3e_`x' = "`est_3e_`x''*"
				}
				
		if s_3e_2s_`x' == 1 {
				local est_3e_`x' = "`est_3e_`x''**"
				}
				
		if s_3e_3s_`x' == 1 {
				local est_3e_`x' = "`est_3e_`x''***"
				}
				
		test treatfull = 0
		local f_walde_`x' = string(`r(p)',"%9.3fc")
		
		lincom treatfull + treatfull_votshare_nat
		local est_4_`x' = string(`r(estimate)',"%9.3fc")
		local se_4_`x' = string(`r(se)',"%9.3fc")
		local se_4_`x' = "`se_4_`x''"
		test treatfull + treatfull_votshare_nat = 0
		local p_4_`x' = string(`r(p)',"%9.3fc")
		
				
		}
	
	* We create the tables concerning the results of the main indices
	
	texdoc init "${tables}/TableI26.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \footnotesize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Main outcomes - Full treatment}
	tex \begin{tabular}{lgggggggg}
	tex \toprule
	tex 											  & (1)                       & (2)                                                          & (3)                                                             & (4)                                                        & (5)  & (6) & (7)                       \\
    tex \multirow{-2}{*}{}                              & \textbf{\begin{tabular}[c]{@{}c@{}}Citizen \\ monitoring\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Perceived citizen \\ pressure\end{tabular}}  & \textbf{Utilization}      & \textbf{\begin{tabular}[c]{@{}c@{}}Treatment \\ quality\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Patient \\ satisfaction\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Health \\ outcomes\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Child \\ mortality\end{tabular}}        \\
	tex \midrule
	tex \multirow{2}{*}{Treat}  & `est_1e_commtg_z' & `est_1e_h_ctzpressure_z' & `est_1e_urate_z'           & `est_1e_treatqual_z'                                                            & `est_1e_patsat_z'                                                              & `est_1e_healthout_z'                                                          & `est_1e_mortrate_05'         \\
	tex  & (`se_1e_commtg_z') & (`se_1e_h_ctzpressure_z') & (`se_1e_urate_z')           & (`se_1e_treatqual_z')                                                            & (`se_1e_patsat_z')                                                              & (`se_1e_healthout_z')                                                         & (`se_1e_mortrate_05')         \\
	tex \multirow{2}{*}{Treat * Museveni vote share above national median (2011)}  & `est_3e_commtg_z' & `est_3e_h_ctzpressure_z' & `est_3e_urate_z'           & `est_3e_treatqual_z'                                                            & `est_3e_patsat_z'                                                              & `est_3e_healthout_z'                                                          & `est_3e_mortrate_05'         \\
	tex  & (`se_3e_commtg_z') & (`se_3e_h_ctzpressure_z') & (`se_3e_urate_z')           & (`se_3e_treatqual_z')                                                            & (`se_3e_patsat_z')                                                              & (`se_3e_healthout_z')                                                         & (`se_3e_mortrate_05')         \\	
	tex \multirow{2}{*}{Constant}  & `est_2e_commtg_z' & `est_2e_h_ctzpressure_z' & `est_2e_urate_z'           & `est_2e_treatqual_z'                                                            & `est_2e_patsat_z'                                                              & `est_2e_healthout_z'                                                          & `est_2e_mortrate_05'         \\
	tex  & (`se_2e_commtg_z') & (`se_2e_h_ctzpressure_z') & (`se_2e_urate_z')           & (`se_2e_treatqual_z')                                                            & (`se_2e_patsat_z')                                                               & (`se_2e_healthout_z')                                                          & `se_2e_mortrate_05'         \\
	tex \midrule
	tex \multirow{1}{*}{N} & `n_1e_commtg_z'  & `n_1e_h_ctzpressure_z' & `n_1e_urate_z'           & `n_1e_treatqual_z'                                                            & `n_1e_patsat_z'                                                            & `n_1e_healthout_z'                                                          & `n_1e_mortrate_05'         \\
	tex \multirow{1}{*}{R$^{2}$}   & `r2_1e_commtg_z'  & `r2_1e_h_ctzpressure_z' & `r2_1e_urate_z'           & `r2_1e_treatqual_z'                                                           & `r2_1e_patsat_z'                                                             & `r2_1e_healthout_z'                                                         & `r2_1e_mortrate_05'         \\
	tex \midrule
	tex \multirow{1}{*}{Coeff. Treat + Treat * Museveni vote share above national median (2011)}  & `est_4_commtg_z' & `est_4_h_ctzpressure_z' & `est_4_urate_z'           & `est_4_treatqual_z'                                                            & `est_4_patsat_z'                                                              & `est_4_healthout_z'                                                          & `est_4_mortrate_05'         \\
	tex \multirow{1}{*}{SE. Treat + Treat * Museveni vote share above national median (2011)}  & `se_4_commtg_z' & `se_4_h_ctzpressure_z' & `se_4_urate_z'           & `se_4_treatqual_z'                                                            & `se_4_patsat_z'                                                              & `se_4_healthout_z'                                                          & `se_4_mortrate_05'         \\
	tex \multirow{1}{*}{P-value Treat + Treat * Museveni vote share above national median (2011)}  & `p_4_commtg_z' & `p_4_h_ctzpressure_z' & `p_4_urate_z'           & `p_4_treatqual_z'                                                            & `p_4_patsat_z'                                                              & `p_4_healthout_z'                                                          & `p_4_mortrate_05'         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close

	****************************************************************************
	* Table I27: By Presidential vote share above or below the sample median *
	****************************************************************************
	
	local var treatfull
	
	* We load the dataset. This is the light version
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	local indices urate_z treatqual_z patsat_z commtg_z
	local indices_ho healthout_z
	local indices_hc mortrate_05 h_ctzpressure_z

	* At endline:
	
	local y = 1
	foreach x in `indices' {
		areg  e_`x' `var' treatfull_votshare_samp b_above_sampmed_nrmpres b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		estimates store me`y'
		
		local n_1e_`x' = string(`e(N)',"%9.0fc")
		local r2_1e_`x' = string(`e(r2)',"%9.3fc")
		local est_1e_`x' = string(_b[`var'],"%9.3fc")
		local se_1e_`x' = string(_se[`var'],"%9.3fc")
		local p_1e_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		local p_`y'e = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1e_1s_`x' = (`p_1e_`x''<=0.1 & `p_1e_`x''>0.05)
		gen s_1e_2s_`x' = (`p_1e_`x''<=0.05 & `p_1e_`x''>0.01)
		gen s_1e_3s_`x' = (`p_1e_`x''<=0.01 & `p_1e_`x''>=0)
	
		if s_1e_1s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''*"
				}
				
		if s_1e_2s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''**"
				}
				
		if s_1e_3s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''***"
				}
		
		local est_2e_`x' = string(_b[_cons],"%9.3fc")
		local se_2e_`x' = string(_se[_cons],"%9.3fc")
		local p_2e_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_2e_1s_`x' = (`p_2e_`x''<=0.1 & `p_2e_`x''>0.05)
		gen s_2e_2s_`x' = (`p_2e_`x''<=0.05 & `p_2e_`x''>0.01)
		gen s_2e_3s_`x' = (`p_2e_`x''<=0.01 & `p_2e_`x''>=0)
	
		if s_2e_1s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''*"
				}
				
		if s_2e_2s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''**"
				}
				
		if s_2e_3s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''***"
				}
				
		local est_3e_`x' = string(_b[treatfull_votshare_samp],"%9.3fc")
		local se_3e_`x' = string(_se[treatfull_votshare_samp],"%9.3fc")
		local p_3e_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_votshare_samp]/_se[treatfull_votshare_samp])))
		
		gen s_3e_1s_`x' = (`p_3e_`x''<=0.1 & `p_3e_`x''>0.05)
		gen s_3e_2s_`x' = (`p_3e_`x''<=0.05 & `p_3e_`x''>0.01)
		gen s_3e_3s_`x' = (`p_3e_`x''<=0.01 & `p_3e_`x''>=0)
	
		if s_3e_1s_`x' == 1 {
				local est_3e_`x' = "`est_3e_`x''*"
				}
				
		if s_3e_2s_`x' == 1 {
				local est_3e_`x' = "`est_3e_`x''**"
				}
				
		if s_3e_3s_`x' == 1 {
				local est_3e_`x' = "`est_3e_`x''***"
				}
				
		test treatfull = 0
		local f_walde_`x' = string(`r(p)',"%9.3fc")
		
		lincom treatfull + treatfull_votshare_samp
		local est_4_`x' = string(`r(estimate)',"%9.3fc")
		local se_4_`x' = string(`r(se)',"%9.3fc")
		local se_4_`x' = "`se_4_`x''"
		test treatfull + treatfull_votshare_samp = 0
		local p_4_`x' = string(`r(p)',"%9.3fc")
		
					
		local y = `y' + 1
		}
		
	********************
	* Individual level *
	********************
	
	* Health outcome

	* At endline
	
	use "${usedata}/healthoutcome_endline_ind.dta", clear
	
	***************
	* Regressions *
	***************

	local var treatfull
	
	areg  e_healthoutcome_z treatfull treatfull_votshare_samp b_healthoutcome_z b_healthoutcome_z_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district) 
	
		estimates store me6
		
		local n_1e_healthout_z = string(`e(N)',"%9.0fc")
		local r2_1e_healthout_z = string(`e(r2)',"%9.3fc")
		local est_1e_healthout_z = string(_b[`var'],"%9.3fc")
		local se_1e_healthout_z = string(_se[`var'],"%9.3fc")
		local p_1e_healthout_z = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		local p_6e = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1e_1s_healthout_z = (`p_1e_healthout_z'<=0.1 & `p_1e_healthout_z'>0.05)
		gen s_1e_2s_healthout_z = (`p_1e_healthout_z'<=0.05 & `p_1e_healthout_z'>0.01)
		gen s_1e_3s_healthout_z = (`p_1e_healthout_z'<=0.01 & `p_1e_healthout_z'>=0)
	
		if s_1e_1s_healthout_z == 1 {
				local est_1e_healthout_z = "`est_1e_healthout_z'*"
				}
				
		if s_1e_2s_healthout_z == 1 {
				local est_1e_healthout_z = "`est_1e_healthout_z'**"
				}
				
		if s_1e_3s_healthout_z == 1 {
				local est_1e_healthout_z = "`est_1e_healthout_z'***"
				}
		
		local est_2e_healthout_z = string(_b[_cons],"%9.3fc")
		local se_2e_healthout_z = string(_se[_cons],"%9.3fc")
		local p_2e_healthout_z = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_2e_1s_healthout_z = (`p_2e_healthout_z'<=0.1 & `p_2e_healthout_z'>0.05)
		gen s_2e_2s_healthout_z = (`p_2e_healthout_z'<=0.05 & `p_2e_healthout_z'>0.01)
		gen s_2e_3s_healthout_z = (`p_2e_healthout_z'<=0.01 & `p_2e_healthout_z'>=0)
	
		if s_2e_1s_healthout_z == 1 {
				local est_2e_healthout_z = "`est_2e_healthout_z'*"
				}
				
		if s_2e_2s_healthout_z == 1 {
				local est_2e_healthout_z = "`est_2e_healthout_z'**"
				}
				
		if s_2e_3s_healthout_z == 1 {
				local est_2e_healthout_z = "`est_2e_healthout_z'***"
				}
				
		local est_3e_healthout_z = string(_b[treatfull_votshare_samp],"%9.3fc")
		local se_3e_healthout_z = string(_se[treatfull_votshare_samp],"%9.3fc")
		local p_3e_healthout_z = (2 * ttail(e(df_r), abs(_b[treatfull_votshare_samp]/_se[treatfull_votshare_samp])))
		
		gen s_3e_1s_healthout_z = (`p_3e_healthout_z'<=0.1 & `p_3e_healthout_z'>0.05)
		gen s_3e_2s_healthout_z = (`p_3e_healthout_z'<=0.05 & `p_3e_healthout_z'>0.01)
		gen s_3e_3s_healthout_z = (`p_3e_healthout_z'<=0.01 & `p_3e_healthout_z'>=0)
	
		if s_3e_1s_healthout_z == 1 {
				local est_3e_`x' = "`est_3e_healthout_z'*"
				}
				
		if s_3e_2s_healthout_z == 1 {
				local est_3e_`x' = "`est_3e_healthout_z'**"
				}
				
		if s_3e_3s_healthout_z == 1 {
				local est_3e_`x' = "`est_3e_healthout_z'***"
				}
				
				
		test treatfull = 0
		local f_walde_healthout_z = string(`r(p)',"%9.3fc")
		
		lincom treatfull + treatfull_votshare_samp
		local est_4_healthout_z = string(`r(estimate)',"%9.3fc")
		local se_4_healthout_z = string(`r(se)',"%9.3fc")
		local se_4_healthout_z = "`se_4_healthout_z'"
		test treatfull + treatfull_votshare_samp = 0
		local p_4_healthout_z = string(`r(p)',"%9.3fc")
		
		
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	local indices_hc mortrate_05 h_ctzpressure_z
	
	* Mortrate HC level (endline)
	
	local y = 7
	foreach x in `indices_hc' {
		areg  e_`x' `var' treatfull_votshare_samp b_above_sampmed_nrmpres b_`x' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		estimates store me`y'
		
		local n_1e_`x' = string(`e(N)',"%9.0fc")
		local r2_1e_`x' = string(`e(r2)',"%9.3fc")
		local est_1e_`x' = string(_b[`var'],"%9.3fc")
		local se_1e_`x' = string(_se[`var'],"%9.3fc")
		local p_1e_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		local p_`y'e = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1e_1s_`x' = (`p_1e_`x''<=0.1 & `p_1e_`x''>0.05)
		gen s_1e_2s_`x' = (`p_1e_`x''<=0.05 & `p_1e_`x''>0.01)
		gen s_1e_3s_`x' = (`p_1e_`x''<=0.01 & `p_1e_`x''>=0)
	
		if s_1e_1s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''*"
				}
				
		if s_1e_2s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''**"
				}
				
		if s_1e_3s_`x' == 1 {
				local est_1e_`x' = "`est_1e_`x''***"
				}
		
		local est_2e_`x' = string(_b[_cons],"%9.3fc")
		local se_2e_`x' = string(_se[_cons],"%9.3fc")
		local p_2e_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_2e_1s_`x' = (`p_2e_`x''<=0.1 & `p_2e_`x''>0.05)
		gen s_2e_2s_`x' = (`p_2e_`x''<=0.05 & `p_2e_`x''>0.01)
		gen s_2e_3s_`x' = (`p_2e_`x''<=0.01 & `p_2e_`x''>=0)
	
		if s_2e_1s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''*"
				}
				
		if s_2e_2s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''**"
				}
				
		if s_2e_3s_`x' == 1 {
				local est_2e_`x' = "`est_2e_`x''***"
				}
				
		local est_3e_`x' = string(_b[treatfull_votshare_samp],"%9.3fc")
		local se_3e_`x' = string(_se[treatfull_votshare_samp],"%9.3fc")
		local p_3e_`x' = (2 * ttail(e(df_r), abs(_b[treatfull_votshare_samp]/_se[treatfull_votshare_samp])))
		
		gen s_3e_1s_`x' = (`p_3e_`x''<=0.1 & `p_3e_`x''>0.05)
		gen s_3e_2s_`x' = (`p_3e_`x''<=0.05 & `p_3e_`x''>0.01)
		gen s_3e_3s_`x' = (`p_3e_`x''<=0.01 & `p_3e_`x''>=0)
	
		if s_3e_1s_`x' == 1 {
				local est_3e_`x' = "`est_3e_`x''*"
				}
				
		if s_3e_2s_`x' == 1 {
				local est_3e_`x' = "`est_3e_`x''**"
				}
				
		if s_3e_3s_`x' == 1 {
				local est_3e_`x' = "`est_3e_`x''***"
				}
				
		test treatfull = 0
		local f_walde_`x' = string(`r(p)',"%9.3fc")
		
		lincom treatfull + treatfull_votshare_samp
		local est_4_`x' = string(`r(estimate)',"%9.3fc")
		local se_4_`x' = string(`r(se)',"%9.3fc")
		local se_4_`x' = "`se_4_`x''"
		test treatfull + treatfull_votshare_samp = 0
		local p_4_`x' = string(`r(p)',"%9.3fc")
		
				
		}
	
	* We create the tables concerning the results of the main indices
	
	texdoc init "${tables}/TableI27.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \footnotesize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Main outcomes - Full treatment}
	tex \begin{tabular}{lgggggggg}
	tex \toprule
	tex 											  & (1)                       & (2)                                                          & (3)                                                             & (4)                                                        & (5)  & (6) & (7)                       \\
    tex \multirow{-2}{*}{}                              & \textbf{\begin{tabular}[c]{@{}c@{}}Citizen \\ monitoring\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Perceived citizen \\ pressure\end{tabular}}  & \textbf{Utilization}      & \textbf{\begin{tabular}[c]{@{}c@{}}Treatment \\ quality\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Patient \\ satisfaction\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Health \\ outcomes\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Child \\ mortality\end{tabular}}        \\
	tex \midrule
	tex \multirow{2}{*}{Treat}  & `est_1e_commtg_z' & `est_1e_h_ctzpressure_z' & `est_1e_urate_z'           & `est_1e_treatqual_z'                                                            & `est_1e_patsat_z'                                                              & `est_1e_healthout_z'                                                          & `est_1e_mortrate_05'         \\
	tex  & (`se_1e_commtg_z') & (`se_1e_h_ctzpressure_z') & (`se_1e_urate_z')           & (`se_1e_treatqual_z')                                                            & (`se_1e_patsat_z')                                                              & (`se_1e_healthout_z')                                                         & (`se_1e_mortrate_05')         \\
	tex \multirow{2}{*}{Treat * Museveni vote share above sample median (2011)}  & `est_3e_commtg_z' & `est_3e_h_ctzpressure_z' & `est_3e_urate_z'           & `est_3e_treatqual_z'                                                            & `est_3e_patsat_z'                                                              & `est_3e_healthout_z'                                                          & `est_3e_mortrate_05'         \\
	tex  & (`se_3e_commtg_z') & (`se_3e_h_ctzpressure_z') & (`se_3e_urate_z')           & (`se_3e_treatqual_z')                                                            & (`se_3e_patsat_z')                                                              & (`se_3e_healthout_z')                                                         & (`se_3e_mortrate_05')         \\	
	tex \multirow{2}{*}{Constant}  & `est_2e_commtg_z' & `est_2e_h_ctzpressure_z' & `est_2e_urate_z'           & `est_2e_treatqual_z'                                                            & `est_2e_patsat_z'                                                              & `est_2e_healthout_z'                                                          & `est_2e_mortrate_05'         \\
	tex  & (`se_2e_commtg_z') & (`se_2e_h_ctzpressure_z') & (`se_2e_urate_z')           & (`se_2e_treatqual_z')                                                            & (`se_2e_patsat_z')                                                               & (`se_2e_healthout_z')                                                          & `se_2e_mortrate_05'         \\
	tex \midrule
	tex \multirow{1}{*}{N} & `n_1e_commtg_z'  & `n_1e_h_ctzpressure_z' & `n_1e_urate_z'           & `n_1e_treatqual_z'                                                            & `n_1e_patsat_z'                                                            & `n_1e_healthout_z'                                                          & `n_1e_mortrate_05'         \\
	tex \multirow{1}{*}{R$^{2}$}   & `r2_1e_commtg_z'  & `r2_1e_h_ctzpressure_z' & `r2_1e_urate_z'           & `r2_1e_treatqual_z'                                                           & `r2_1e_patsat_z'                                                             & `r2_1e_healthout_z'                                                         & `r2_1e_mortrate_05'         \\
	tex \midrule
	tex \multirow{1}{*}{Coeff. Treat + Treat * Museveni vote share above sample median (2011)}  & `est_4_commtg_z' & `est_4_h_ctzpressure_z' & `est_4_urate_z'           & `est_4_treatqual_z'                                                            & `est_4_patsat_z'                                                              & `est_4_healthout_z'                                                          & `est_4_mortrate_05'         \\
	tex \multirow{1}{*}{SE. Treat + Treat * Museveni vote share above sample median (2011)}  & `se_4_commtg_z' & `se_4_h_ctzpressure_z' & `se_4_urate_z'           & `se_4_treatqual_z'                                                            & `se_4_patsat_z'                                                              & `se_4_healthout_z'                                                          & `se_4_mortrate_05'         \\
	tex \multirow{1}{*}{P-value Treat + Treat * Museveni vote share above sample median (2011)}  & `p_4_commtg_z' & `p_4_h_ctzpressure_z' & `p_4_urate_z'           & `p_4_treatqual_z'                                                            & `p_4_patsat_z'                                                              & `p_4_healthout_z'                                                          & `p_4_mortrate_05'         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	
	*********************************************
	* Table I28: Robustness check main outcomes *
	*********************************************
	
	* At endline
	
	* We need to compute robustness check for Main and Intermediate outcomes
	
	* No control
	* No FE
	* HC agregated level
	* Diff and diff with baseline
	
	******************************
	* Main Intermediate outcomes *
	******************************
	
	* We load the dataset. This is the light version
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* In this part, we regress the outcomes over the full treatment vs control
	
	local var treatfull
	
	local indices urate_z treatqual_z treatqualalt_z patsat_z commtg_z
	
	local indices_hc h_ctzpressure_z mortrate_05
	
	* At endline:
	
	**************
	* No control *
	**************
	
	eststo clear

	foreach x in `indices' {
		areg  e_`x' `var' b_`x' b_`x'_d, robust cl(hc_id) a(district)
		local n_nocon_`x' = string(`e(N)',"%9.0fc")
		local b_nocon_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocon_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocon_`x' =string(_se[_cons],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local csb_nocon_`x' `csb_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local csb_nocon_`x' `csb_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local csb_nocon_`x' `csb_nocon_`x''***
		}
		
		}
	
	* We include child mortality indicator at hc level
	
	foreach x in `indices_hc' {
		areg  e_`x' `var' b_`x' if uniquehc == 1, robust a(district)
		local n_nocon_`x' = string(`e(N)',"%9.0fc")
		local b_nocon_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocon_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocon_`x' =string(_se[_cons],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local csb_nocon_`x' `csb_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local csb_nocon_`x' `csb_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local csb_nocon_`x' `csb_nocon_`x''***
		}
		
		}
		
	*********
	* No FE *
	*********
	
	* We define the control variable
	
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	foreach x in e_ {
	
		local `x'controls_tfull
		local `x'controls_tfull_hc
		
		}
		
	foreach x in e_ {
		foreach var in treatfull {
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			}
		}
		
	foreach var of local e_controls_noprefix {
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}	
				
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			}
		}
	
	
	eststo clear
	
	local var treatfull
	
	foreach x in `indices' {
		reg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', cl(hc_id) robust
		local n_nofe_`x' = string(`e(N)',"%9.0fc")
		local b_nofe_`x' = string(_b[treatfull],"%9.3fc")
		local se_nofe_`x' =string(_se[treatfull],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = string(_b[_cons],"%9.3fc")
		local csse_nofe_`x' =string(_se[_cons],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local csb_nofe_`x' `csb_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local csb_nofe_`x' `csb_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local csb_nofe_`x' `csb_nofe_`x''***
		}
		
		}
		
	foreach x in `indices_hc' {
		reg  e_`x' `var' b_`x' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust
		local n_nofe_`x' = string(`e(N)',"%9.0fc")
		local b_nofe_`x' = string(_b[treatfull],"%9.3fc")
		local se_nofe_`x' =string(_se[treatfull],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = string(_b[_cons],"%9.3fc")
		local csse_nofe_`x' =string(_se[_cons],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local csb_nofe_`x' `csb_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local csb_nofe_`x' `csb_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local csb_nofe_`x' `csb_nofe_`x''***
		}
		
		}
		
		
	*****************************
	* Added later: No Cov * Int *
	*****************************
	
	* We define the control variable
	
	eststo clear
	
	local var treatfull
	
	foreach x in `indices' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' , cl(hc_id) robust a(district)
		local n_nocovint_`x' = string(`e(N)',"%9.0fc")
		local b_nocovint_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocovint_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocovint_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocovint_`x'' <= 0.1 & `p_nocovint_`x'' > 0.05{
			local b_nocovint_`x' `b_nocovint_`x''*
		}
	
		if `p_nocovint_`x'' <= 0.05 & `p_nocovint_`x'' > 0.01{
			local b_nocovint_`x' `b_nocovint_`x''**
		}
		
		if `p_nocovint_`x'' <= 0.01 & `p_nocovint_`x'' > 0 {
			local b_nocovint_`x' `b_nocovint_`x''***
		}
		
		local csb_nocovint_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocovint_`x' =string(_se[_cons],"%9.3fc")
		local p_nocovint_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocovint_`x'' <= 0.1 & `p_nocovint_`x'' > 0.05{
			local csb_nofe_`x' `csb_nocovint_`x''*
		}
	
		if `p_nocovint_`x'' <= 0.05 & `p_nocovint_`x'' > 0.01{
			local csb_nocovint_`x' `csb_nocovint_`x''**
		}
		
		if `p_nocovint_`x'' <= 0.01 & `p_nocovint_`x'' > 0 {
			local csb_nocovint_`x' `csb_nocovint_`x''***
		}
		
		}
	
		
	foreach x in `indices_hc' {
		areg  e_`x' `var' b_`x' `e_controls_tfull_hc' if uniquehc == 1, robust a(district)
		local n_nocovint_`x' = string(`e(N)',"%9.0fc")
		local b_nocovint_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocovint_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocovint_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocovint_`x'' <= 0.1 & `p_nocovint_`x'' > 0.05{
			local b_nocovint_`x' `b_nocovint_`x''*
		}
	
		if `p_nocovint_`x'' <= 0.05 & `p_nocovint_`x'' > 0.01{
			local b_nocovint_`x' `b_nocovint_`x''**
		}
		
		if `p_nocovint_`x'' <= 0.01 & `p_nocovint_`x'' > 0 {
			local b_nocovint_`x' `b_nocovint_`x''***
		}
		
		local csb_nocovint_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocovint_`x' =string(_se[_cons],"%9.3fc")
		local p_nocovint_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocovint_`x'' <= 0.1 & `p_nocovint_`x'' > 0.05{
			local csb_nocovint_`x' `csb_nocovint_`x''*
		}
	
		if `p_nocovint_`x'' <= 0.05 & `p_nocovint_`x'' > 0.01{
			local csb_nocovint_`x' `csb_nocovint_`x''**
		}
		
		if `p_nocovint_`x'' <= 0.01 & `p_nocovint_`x'' > 0 {
			local csb_nocovint_`x' `csb_nocovint_`x''***
		}
		
		}
		
	*************************
	* Agregated at HC level *
	*************************
	
	local indices_hc mortrate_05 h_ctzpressure_z
	
	* Our first step is to create the mean at HC level
	
	foreach x of local indices {
		byso hc_id : egen mean_e_`x' = mean(e_`x')
		byso hc_id : egen mean_b_`x' = mean(b_`x')
		byso hc_id : egen mean_b_`x'_d = mean(b_`x'_d)
		}
		
	foreach x of local indices_hc {
		byso hc_id : egen mean_e_`x' = mean(e_`x')
		byso hc_id : egen mean_b_`x' = mean(b_`x')
		}
	
	
	eststo clear
	
	local var treatfull
	
	foreach x in `indices' {
		areg  mean_e_`x' `var' mean_b_`x' mean_b_`x'_d `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		local n_mean_`x' = string(`e(N)',"%9.0fc")
		local b_mean_`x' = string(_b[treatfull],"%9.3fc")
		local se_mean_`x' =string(_se[treatfull],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local b_mean_`x' `b_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local b_mean_`x' `b_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local b_mean_`x' `b_mean_`x''***
		}
		
		local csb_mean_`x' = string(_b[_cons],"%9.3fc")
		local csse_mean_`x' =string(_se[_cons],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local csb_mean_`x' `csb_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local csb_mean_`x' `csb_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local csb_mean_`x' `csb_mean_`x''***
		}
		
		}

	eststo clear
			
	foreach x in `indices_hc' {
		areg  mean_e_`x' `var' mean_b_`x' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		local n_mean_`x' = string(`e(N)',"%9.0fc")
		local b_mean_`x' = string(_b[treatfull],"%9.3fc")
		local se_mean_`x' =string(_se[treatfull],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local b_mean_`x' `b_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local b_mean_`x' `b_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local b_mean_`x' `b_mean_`x''***
		}
		
		local csb_mean_`x' = string(_b[_cons],"%9.3fc")
		local csse_mean_`x' =string(_se[_cons],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local csb_mean_`x' `csb_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local csb_mean_`x' `csb_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local csb_mean_`x' `csb_mean_`x''***
		}
		
		}
		
	***********************************
	* Diff in Diff endline - baseline *
	***********************************
	
	local add_control
	
	foreach var of local indices {
		local add_control `add_control' b_`var'_d
		}
	
	local var treatfull
	
	local e_indices e_urate_z e_treatqual_z e_treatqualalt_z e_patsat_z e_commtg_z
	local e_indices_hc e_mortrate_05 e_h_ctzpressure_z
	
	local b_indices b_urate_z b_treatqual_z b_treatqualalt_z b_patsat_z b_commtg_z
	local b_indices_hc b_mortrate_05 b_h_ctzpressure_z
	
	keep hh_id hc_id `add_control' `b_indices' `b_indices_hc' `e_indices' `e_indices_hc' `e_controls_tfull' `e_controls_tfull_hc' ``var'_int_e_controls' ``var'_hc_int_e_controls' district uniquehc treatfull endline_presence
	
	foreach x of local indices {
		ren b_`x' `x'_b
		ren e_`x' `x'_e
		}
		
	foreach x of local indices_hc {
		ren b_`x' `x'_b
		ren e_`x' `x'_e
		}
		
	reshape long `indices' `indices_hc' , i(hh_id) j(num) s
	
	gen y16 = (num == "_e")
	
	drop num
	
	gen t_16 = treatfull*y16
	
	local indices urate_z treatqual_z treatqualalt_z patsat_z commtg_z
	
	foreach x in `indices' {
		areg `x' t_16 y16 b_`x'_d `e_controls_tfull' ``var'_int_e_controls' if endline_presence == 1, robust cl(hc_id) a(district)
		local n_dd_`x' = string(`e(N)',"%9.0fc")
		local b_dd_`x' = string(_b[t_16],"%9.3fc")
		local se_dd_`x' =string(_se[t_16],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[t_16]/_se[t_16])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local b_dd_`x' `b_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local b_dd_`x' `b_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local b_dd_`x' `b_dd_`x''***
		}
		
		local csb_dd_`x' = string(_b[_cons],"%9.3fc")
		local csse_dd_`x' =string(_se[_cons],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local csb_dd_`x' `csb_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local csb_dd_`x' `csb_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local csb_dd_`x' `csb_dd_`x''***
		}
		
		}
		
	eststo clear
	
	foreach x in `indices_hc' {
		areg `x' t_16 y16 `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		local n_dd_`x' = string(`e(N)',"%9.0fc")
		local b_dd_`x' = string(_b[t_16],"%9.3fc")
		local se_dd_`x' =string(_se[t_16],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[t_16]/_se[t_16])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local b_dd_`x' `b_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local b_dd_`x' `b_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local b_dd_`x' `b_dd_`x''***
		}
		
		local csb_dd_`x' = string(_b[_cons],"%9.3fc")
		local csse_dd_`x' =string(_se[_cons],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local csb_dd_`x' `csb_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local csb_dd_`x' `csb_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local csb_dd_`x' `csb_dd_`x''***
		}
		
		}
	
	**************
	* Individual *
	**************
	
	* Health outcome
	
	* We load the dataset. This is the light version
	
	use "${usedata}/healthoutcome_endline_ind.dta", clear
	
	* In this part, we regress the outcomes over the full treatment vs control
	
	local var treatfull
	
	local x healthoutcome_z
	
	* At endline:
	
	**************
	* No control *
	**************
	
	eststo clear

		areg  e_`x' `var' b_`x', robust cl(hc_id) a(district)
		local n_nocon_`x' = string(`e(N)',"%9.0fc")
		local b_nocon_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocon_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocon_`x' =string(_se[_cons],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local csb_nocon_`x' `csb_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local csb_nocon_`x' `csb_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local csb_nocon_`x' `csb_nocon_`x''***
		}
		
	
	*********
	* No FE *
	*********
	
	* We define the control variable
	
	local var treatfull
	
	local x healthoutcome_z
	
	eststo clear
	
		reg  e_`x' `var' b_`x' `e_controls_tfull' ``var'_int_e_controls', cl(hc_id) robust
		local n_nofe_`x' = string(`e(N)',"%9.0fc")
		local b_nofe_`x' = string(_b[treatfull],"%9.3fc")
		local se_nofe_`x' =string(_se[treatfull],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = string(_b[_cons],"%9.3fc")
		local csse_nofe_`x' =string(_se[_cons],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local csb_nofe_`x' `csb_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local csb_nofe_`x' `csb_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local csb_nofe_`x' `csb_nofe_`x''***
		}

	* We define the control variable
	
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	foreach x in e_ {
	
		local `x'controls_tfull
		
		}
		
	foreach x in e_ {
		foreach var in treatfull {
			local `var'_int_`x'controls
						}
		}
		
	foreach var of local e_controls_noprefix {
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
			}	
				
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
				}
		}
	
	
	local var treatfull
	
	local x healthoutcome_z
	
	eststo clear
	
	areg  e_`x' `var' b_`x' `e_controls_tfull' ``var'_int_e_controls', cl(hc_id) robust a(district)
		local n_nocovint_`x' = string(`e(N)',"%9.0fc")
		local b_nocovint_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocovint_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocovint_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocovint_`x'' <= 0.1 & `p_nocovint_`x'' > 0.05{
			local b_nocovint_`x' `b_nocovint_`x''*
		}
	
		if `p_nocovint_`x'' <= 0.05 & `p_nocovint_`x'' > 0.01{
			local b_nocovint_`x' `b_nocovint_`x''**
		}
		
		if `p_nocovint_`x'' <= 0.01 & `p_nocovint_`x'' > 0 {
			local b_nocovint_`x' `b_nocovint_`x''***
		}
		
		local csb_nocovint_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocovint_`x' =string(_se[_cons],"%9.3fc")
		local p_nocovint_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocovint_`x'' <= 0.1 & `p_nocovint_`x'' > 0.05{
			local csb_nocovint_`x' `csb_nocovint_`x''*
		}
	
		if `p_nocovint_`x'' <= 0.05 & `p_nocovint_`x'' > 0.01{
			local csb_nocovint_`x' `csb_nocovint_`x''**
		}
		
		if `p_nocovint_`x'' <= 0.01 & `p_nocovint_`x'' > 0 {
			local csb_nocovint_`x' `csb_nocovint_`x''***
		}
	
	*************************
	* Agregated at HC level *
	*************************
	
	preserve
	
	** Our first step is to create the mean at HC level
	
	byso hc_id : egen tmean_e_`x' = mean(e_`x') 
	byso hc_id : egen mean_e_`x' = max(tmean_e_`x')
	
	byso hc_id : egen tmean_b_`x' = mean(b_`x')
	byso hc_id : egen mean_b_`x' = max(tmean_b_`x')
	
	drop tmean_*
	
	* We need to do the same at hc level
	
	local controls hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
	
	* We create unique hh as we are at child level
	
	byso hh_id: gen count = _n
	
	* We will remove the mean from the control variable
	
	* Full treatment ( we don't need to create a endline presence as we already have a sample with only household present)

	foreach var of local controls {
		byso hc_id: egen temp_mean_`var' = mean(`var') if treatfull != . & count == 1
		byso hc_id: egen t_mean_`var' = max(temp_mean_`var') if treatfull != .
		qui sum t_mean_`var' if treatfull != . & uniquehc == 1
		gen c_tfull_hc_`var' = t_mean_`var' - `r(mean)'
		lab var c_tfull_hc_`var' "Control variable of `var' minus its mean in the full treatment at hc level"
		drop t_mean_`var' temp_mean_`var'
		}
		
	drop count
	
	* Full treatment
	
	foreach x of local controls {
			gen c_treatfull_hc_`x' = treatfull * c_tfull_hc_`x'
			lab var c_treatfull_hc_`x' "Interaction term of contral variable `x' with treatment at hc level"
			}
	
	* We take care of duplicates 
	
	duplicates drop hh_id uniquehc, force
	
	drop uniquehc 
	
	egen uniquehc = tag(hc_id) if endline_presence == 1
	recode uniquehc(.=0)
	lab var uniquehc "Unique HC"
	
	* We local the variable
	
	local var treatfull
	
	local x healthoutcome_z
	
	eststo clear
	
		areg  mean_e_`x' `var' mean_b_`x' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		local n_mean_`x' = string(`e(N)',"%9.0fc")
		local b_mean_`x' = string(_b[treatfull],"%9.3fc")
		local se_mean_`x' =string(_se[treatfull],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local b_mean_`x' `b_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local b_mean_`x' `b_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local b_mean_`x' `b_mean_`x''***
		}
		
		local csb_mean_`x' = string(_b[_cons],"%9.3fc")
		local csse_mean_`x' =string(_se[_cons],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local csb_mean_`x' `csb_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local csb_mean_`x' `csb_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local csb_mean_`x' `csb_mean_`x''***
		}
		
	restore
	
	***********************************
	* Diff in Diff endline - baseline *
	***********************************

	local var treatfull
	
	local x healthoutcome_z
	
	keep hh_id hc_id e_healthoutcome_z b_healthoutcome_z `e_controls_tfull' ``var'_int_e_controls'  district uniquehc treatfull endline_presence
	
	gen nomeasure_endline = (b_healthoutcome_z == . | e_healthoutcome_z == .)
	replace nomeasure_endline = 1 if endline_presence == 0
	
	ren b_`x' `x'_b
	ren e_`x' `x'_e
	
	* Creating a new id to reshape
	
	byso hh_id: gen temp = _n
	
	tostring hh_id temp, replace
	
	replace hh_id = hh_id + temp
	
	destring hh_id, replace
	
	drop temp
	
	* Reshape
	
	reshape long healthoutcome_z , i(hh_id) j(num) s
	
	gen y16 = (num == "_e")
	
	drop num
	
	gen t_16 = treatfull*y16
	
		areg `x' t_16 y16 `e_controls_tfull' ``var'_int_e_controls' if endline_presence == 1, robust cl(hc_id) a(district)
		local n_dd_`x' = string(`e(N)',"%9.0fc")
		local b_dd_`x' = string(_b[t_16],"%9.3fc")
		local se_dd_`x' =string(_se[t_16],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[t_16]/_se[t_16])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local b_dd_`x' `b_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local b_dd_`x' `b_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local b_dd_`x' `b_dd_`x''***
		}
		
		local csb_dd_`x' = string(_b[_cons],"%9.3fc")
		local csse_dd_`x' =string(_se[_cons],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local csb_dd_`x' `csb_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local csb_dd_`x' `csb_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local csb_dd_`x' `csb_dd_`x''***
		}
	
	* Child mortality
	
	* We load the dataset. This is the light version
	
	use "${usedata}/mortality_endline_ind.dta", clear
	
	* In this part, we regress the outcomes over the full treatment vs control
	
	local var treatfull
	
	local x mortrate_z
	
	local controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
	
	foreach bracket in 05 {
		local controls_tfull`bracket'
		}

	foreach bracket in 05 {
		foreach var in treatfull {
			local `var'_`bracket'_controls
			}
		}
		
	foreach bracket in 05 {
		foreach var of local controls_noprefix {
			local controls_tfull`bracket' `controls_tfull`bracket'' c_tfull`bracket'_`var'
			}
		}
	
	foreach bracket in 05 {
		foreach treat in treatfull {
			foreach var of local controls_noprefix {
				local `treat'_`bracket'_controls ``treat'_`bracket'_controls' c_`treat'`bracket'_`var'
				}
			}
		}
		
	* At endline:
	
	**************
	* No control *
	**************
	
	eststo clear

		stset e_survmonths_ab_05, failure(dead_endline==1) id(childroster_id)
		stcox treatfull b_mortrate_05 e_birthmonth  if e_agebracket_05 == 1, vce(cluster hc_id)
		
		local n_nocon_`x' = string(`e(N)',"%9.0fc")
		local b_nocon_`x' = string(exp(_b[treatfull]),"%9.3fc")
		
		local se_nocon_`x' exp(_b[treatfull])*_se[treatfull]
		local se_nocon_`x' = string(`se_nocon_`x'',"%9.3fc")
		
		local p_nocon_`x' = 0.811
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = "n/a"
		local csse_nocon_`x' = "n/a"
	
	*********
	* No FE *
	*********
	
	eststo clear
	
		stset e_survmonths_ab_05, failure(dead_endline==1) id(childroster_id)
		stcox treatfull `controls_tfull05' `treatfull_05_controls' b_mortrate_05 e_birthmonth if e_agebracket_05 == 1, vce(cluster hc_id)
		
		local n_nofe_`x' = string(`e(N)',"%9.0fc")
		local b_nofe_`x' = string(exp(_b[treatfull]),"%9.3fc")
		local se_nofe_`x' exp(_b[treatfull])*_se[treatfull]
		local se_nofe_`x' = string(`se_nofe_`x'',"%9.3fc")
		
		local p_nofe_`x' = 0.799
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = "n/a"
		local csse_nofe_`x' = "n/a"
		
		
	* We outsheet the results
	
	* We include the version with child mortality indicator at hc level
	
	texdoc init "${tables}/TableI28.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \small
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Robustness checks -- Main outcomes}
	tex \begin{tabular}{lggggggg}
	tex \toprule
	tex 											  & (1)                       & (2)                                                          & (3)                                                             & (4)                                                        & (5) & (6) & (7)                        \\
    tex                              & \textbf{\begin{tabular}[c]{@{}c@{}}Citizen \\ monitoring\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Perceived \\ citizen \\ pressure\end{tabular}} & \textbf{Utilization}      & \textbf{\begin{tabular}[c]{@{}c@{}}Treatment \\ quality\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Patient \\ satisfaction\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Health \\ outcomes\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Child \\ mortality\end{tabular}}        \\
	tex \midrule
	tex \textit{A: Without control variables} \\
	tex \multirow{2}{*}{Program impact}  &`b_nocon_commtg_z' &`b_nocon_h_ctzpressure_z' &`b_nocon_urate_z'           & `b_nocon_treatqual_z'                                                            & `b_nocon_patsat_z'                                                               & `b_nocon_healthoutcome_z'                                                          & `b_nocon_mortrate_05'         \\
	tex  & (`se_nocon_commtg_z') & (`se_nocon_h_ctzpressure_z') & (`se_nocon_urate_z')           & (`se_nocon_treatqual_z')                                                            & (`se_nocon_patsat_z')                                                               & (`se_nocon_healthoutcome_z')                                                          & (`se_nocon_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}   &`csb_nocon_commtg_z' &`csb_nocon_h_ctzpressure_z' &`csb_nocon_urate_z'           & `csb_nocon_treatqual_z'                                                            & `csb_nocon_patsat_z'                                                               & `csb_nocon_healthoutcome_z'                                                          & `csb_nocon_mortrate_05'         \\
	tex  & (`csse_nocon_commtg_z') & (`csse_nocon_h_ctzpressure_z') & (`csse_nocon_urate_z')           & (`csse_nocon_treatqual_z')                                                            & (`csse_nocon_patsat_z')                                                               & (`csse_nocon_healthoutcome_z')                                                          & `csse_nocon_mortrate_05'         \\
	tex \\
	tex \textit{B: Without district fixed effects} \\
	tex \multirow{2}{*}{Program impact}  &`b_nofe_commtg_z' &`b_nofe_h_ctzpressure_z' &`b_nofe_urate_z'           & `b_nofe_treatqual_z'                                                            & `b_nofe_patsat_z'                                                               & `b_nofe_healthoutcome_z'                                                          & `b_nofe_mortrate_05'         \\
	tex  & (`se_nofe_commtg_z') & (`se_nofe_h_ctzpressure_z') & (`se_nofe_urate_z')           & (`se_nofe_treatqual_z')                                                            & (`se_nofe_patsat_z')                                                               & (`se_nofe_healthoutcome_z')                                                          & (`se_nofe_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}   &`csb_nofe_commtg_z' &`csb_nofe_h_ctzpressure_z' &`csb_nofe_urate_z'           & `csb_nofe_treatqual_z'                                                            & `csb_nofe_patsat_z'                                                               & `csb_nofe_healthoutcome_z'                                                          & `csb_nofe_mortrate_05'         \\
	tex  & (`csse_nofe_commtg_z') & (`csse_nofe_h_ctzpressure_z') & (`csse_nofe_urate_z')           & (`csse_nofe_treatqual_z')                                                            & (`csse_nofe_patsat_z')                                                               & (`csse_nofe_healthoutcome_z')                                                          & `csse_nofe_mortrate_05'         \\
	tex \\ 
	tex \textit{C: With outcome measures aggregated at HC level} \\
	tex \multirow{2}{*}{Program impact}   &`b_mean_commtg_z' &`b_mean_h_ctzpressure_z' &`b_mean_urate_z'           & `b_mean_treatqual_z'                                                            & `b_mean_patsat_z'                                                               & `b_mean_healthoutcome_z'                                                          & `b_mean_mortrate_05'         \\
	tex  & (`se_mean_commtg_z') & (`se_mean_h_ctzpressure_z') & (`se_mean_urate_z')           & (`se_mean_treatqual_z')                                                            & (`se_mean_patsat_z')                                                               & (`se_mean_healthoutcome_z')                                                          & (`se_mean_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}   &`csb_mean_commtg_z' &`csb_mean_h_ctzpressure_z' &`csb_mean_urate_z'           & `csb_mean_treatqual_z'                                                            & `csb_mean_patsat_z'                                                               & `csb_mean_healthoutcome_z'                                                          & `csb_mean_mortrate_05'         \\
	tex  &(`csse_mean_commtg_z') & (`csse_mean_h_ctzpressure_z') & (`csse_mean_urate_z')           & (`csse_mean_treatqual_z')                                                            & (`csse_mean_patsat_z')                                                               & (`csse_mean_healthoutcome_z')                                                          & (`csse_mean_mortrate_05')         \\
	tex \\ 
	tex \textit{D: Difference between post and pre-treatment values} \\
	tex \multirow{2}{*}{Program impact}   &`b_dd_commtg_z' &`b_dd_h_ctzpressure_z' &`b_dd_urate_z'           & `b_dd_treatqual_z'                                                            & `b_dd_patsat_z'                                                               & `b_dd_healthoutcome_z'                                                          & `b_dd_mortrate_05'         \\
	tex  & (`se_dd_commtg_z') & (`se_dd_h_ctzpressure_z') & (`se_dd_urate_z')           & (`se_dd_treatqual_z')                                                            & (`se_dd_patsat_z')                                                               & (`se_dd_healthoutcome_z')                                                          & (`se_dd_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}   &`csb_dd_commtg_z' &`csb_dd_h_ctzpressure_z' &`csb_dd_urate_z'           & `csb_dd_treatqual_z'                                                            & `csb_dd_patsat_z'                                                               & `csb_dd_healthoutcome_z'                                                          & `csb_dd_mortrate_05'         \\
	tex  &(`csse_dd_commtg_z') & (`csse_dd_h_ctzpressure_z') & (`csse_dd_urate_z')           & (`csse_dd_treatqual_z')                                                            & (`csse_dd_patsat_z')                                                               & (`csse_dd_healthoutcome_z')                                                          & (`csse_dd_mortrate_05')         \\
		tex \textit{E: Without control variable * treatment interaction} \\
	tex \multirow{2}{*}{Program impact}  &`b_nocovint_commtg_z' &`b_nocovint_h_ctzpressure_z' &`b_nocovint_urate_z'           & `b_nocovint_treatqual_z'                                                            & `b_nocovint_patsat_z'                                                               & `b_nocovint_healthoutcome_z'                                                          & `b_nocovint_mortrate_05'         \\
	tex  & (`se_nocovint_commtg_z') & (`se_nocovint_h_ctzpressure_z') & (`se_nocovint_urate_z')           & (`se_nocovint_treatqual_z')                                                            & (`se_nocovint_patsat_z')                                                               & (`se_nocovint_healthoutcome_z')                                                          & (`se_nocovint_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}   &`csb_nocovint_commtg_z' &`csb_nocovint_h_ctzpressure_z' &`csb_nocovint_urate_z'           & `csb_nocovint_treatqual_z'                                                            & `csb_nocovint_patsat_z'                                                               & `csb_nocovint_healthoutcome_z'                                                          & `csb_nocovint_mortrate_05'         \\
	tex  & (`csse_nocovint_commtg_z') & (`csse_nocovint_h_ctzpressure_z') & (`csse_nocovint_urate_z')           & (`csse_nocovint_treatqual_z')                                                            & (`csse_nocovint_patsat_z')                                                               & (`csse_nocovint_healthoutcome_z')                                                          & `csse_nocovint_mortrate_05'         \\
	tex \\
	
	
	tex \midrule
	tex Observations (A, B \& E)  &`n_nocon_commtg_z' &`n_nocon_h_ctzpressure_z' &`n_nocon_urate_z'           & `n_nocon_treatqual_z'                                                            & `n_nocon_patsat_z'                                                               & `n_nocon_healthoutcome_z'                                                          & `n_nocon_mortrate_05'         \\
	tex Observations (C) &`n_mean_commtg_z' &`n_mean_h_ctzpressure_z' & `n_mean_urate_z'           & `n_mean_treatqual_z'                                                            & `n_mean_patsat_z'                                                               & `n_mean_healthoutcome_z'                                                          & `n_mean_mortrate_05'         \\
	tex Observations (D) &`n_dd_commtg_z' &`n_dd_h_ctzpressure_z' & `n_dd_urate_z'           & `n_dd_treatqual_z'                                                            & `n_dd_patsat_z'                                                               & `n_dd_healthoutcome_z'                                                          & `n_dd_mortrate_05'         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	
	********************************************************
	* Table I29: Robustness checks – Intermediate outcomes *
	********************************************************
	
	* At endline
	
	use "${usedata}/chp_el_light_dataset.dta", clear
		
	**************
	* No control *
	**************
	
	local var treatfull
	
	eststo clear

	foreach x in `intermediate' {
		areg  e_`x' `var' b_`x' b_`x'_d, robust cl(hc_id) a(district)
		local n_nocon_`x' = `e(N)'
		local b_nocon_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocon_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocon_`x' =string(_se[_cons],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local csb_nocon_`x' `csb_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local csb_nocon_`x' `csb_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local csb_nocon_`x' `csb_nocon_`x''***
		}
		
		}
		
	eststo clear
			
	foreach x in `intermediate_hclevel' {
		areg  e_`x' `var' b_`x' b_`x'_d if uniquehc == 1, robust a(district)
		local n_nocon_`x' = `e(N)'
		local b_nocon_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocon_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocon_`x' =string(_se[_cons],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local csb_nocon_`x' `csb_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local csb_nocon_`x' `csb_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local csb_nocon_`x' `csb_nocon_`x''***
		}
		
		}
	
	*********
	* No FE *
	*********
	
	eststo clear
	
	foreach x in `intermediate' {
		reg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', cl(hc_id) robust
		local n_nofe_`x' = `e(N)'
		local b_nofe_`x' = string(_b[treatfull],"%9.3fc")
		local se_nofe_`x' =string(_se[treatfull],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = string(_b[_cons],"%9.3fc")
		local csse_nofe_`x' =string(_se[_cons],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local csb_nofe_`x' `csb_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local csb_nofe_`x' `csb_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local csb_nofe_`x' `csb_nofe_`x''***
		}
		
		}
		
	eststo clear
			
	foreach x in `intermediate_hclevel' {
		reg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust
		local n_nofe_`x' = `e(N)'
		local b_nofe_`x' = string(_b[treatfull],"%9.3fc")
		local se_nofe_`x' =string(_se[treatfull],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = string(_b[_cons],"%9.3fc")
		local csse_nofe_`x' =string(_se[_cons],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local csb_nofe_`x' `csb_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local csb_nofe_`x' `csb_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local csb_nofe_`x' `csb_nofe_`x''***
		}
		
		}
		
	*************************
	* Agregated at HC level *
	*************************
		
	foreach x of local intermediate {
		byso hc_id : egen mean_e_`x' = mean(e_`x')
		byso hc_id : egen mean_b_`x' = mean(b_`x')
		byso hc_id : egen mean_b_`x'_d = mean(b_`x'_d)
		}
	
	* Already aggregated just for the form
	
	foreach x of local intermediate_hclevel {
		byso hc_id : egen mean_e_`x' = mean(e_`x')
		byso hc_id : egen mean_b_`x' = mean(b_`x')
		byso hc_id : egen mean_b_`x'_d = mean(b_`x'_d)
		}
	
	eststo clear
	
	local var treatfull
	
	eststo clear
	
	foreach x in `intermediate' {
		areg  mean_e_`x' `var' mean_b_`x' mean_b_`x'_d `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust  a(district)
		local n_mean_`x' = `e(N)'
		local b_mean_`x' = string(_b[treatfull],"%9.3fc")
		local se_mean_`x' =string(_se[treatfull],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local b_mean_`x' `b_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local b_mean_`x' `b_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local b_mean_`x' `b_mean_`x''***
		}
		
		local csb_mean_`x' = string(_b[_cons],"%9.3fc")
		local csse_mean_`x' =string(_se[_cons],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local csb_mean_`x' `csb_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local csb_mean_`x' `csb_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local csb_mean_`x' `csb_mean_`x''***
		}
		
		}
		
	eststo clear
			
	foreach x in `intermediate_hclevel' {
		areg  mean_e_`x' `var' mean_b_`x' mean_b_`x'_d `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		local n_mean_`x' = `e(N)'
		local b_mean_`x' = string(_b[treatfull],"%9.3fc")
		local se_mean_`x' =string(_se[treatfull],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local b_mean_`x' `b_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local b_mean_`x' `b_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local b_mean_`x' `b_mean_`x''***
		}
		
		local csb_mean_`x' = string(_b[_cons],"%9.3fc")
		local csse_mean_`x' =string(_se[_cons],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local csb_mean_`x' `csb_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local csb_mean_`x' `csb_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local csb_mean_`x' `csb_mean_`x''***
		}
		
		}
		
	***********************************
	* Diff in Diff endline - baseline *
	***********************************
	
	local add_control
		
	foreach var of local intermediate {
		local add_control `add_control' b_`var'_d
		}
		
	foreach var of local intermediate_hclevel {
		local add_control `add_control' b_`var'_d
		}
	
	local var treatfull
	
	local b_intermediate b_ctzknow_z b_eff_z b_commresp_z b_relhhhc_z
	local e_intermediate e_ctzknow_z e_eff_z e_commresp_z e_relhhhc_z
	
	local b_intermediate_hclevel b_h_hcpknow_z b_h_hctrans_z
	local e_intermediate_hclevel e_h_hcpknow_z e_h_hctrans_z
	
	keep hh_id hc_id `add_control' `b_intermediate' `b_intermediate_hclevel' `e_intermediate' `e_intermediate_hclevel' `e_controls_tfull_hc' ``var'_hc_int_e_controls' `e_controls_tfull' ``var'_int_e_controls' `e_controls_tfull_hoe' `tfulli_hoe_e_controls' district uniquehc treatfull endline_presence
		
	foreach x of local intermediate {
		ren b_`x' `x'_b
		ren e_`x' `x'_e
		}
		
	foreach x of local intermediate_hclevel {
		ren b_`x' `x'_b
		ren e_`x' `x'_e
		}
		
	reshape long  `intermediate' `intermediate_hclevel', i(hh_id) j(num) s
	
	gen y16 = (num == "_e")
	
	drop num
	
	gen t_16 = treatfull*y16
	
	eststo clear
	
	foreach x in `intermediate' {
		areg `x' t_16 y16 b_`x'_d `e_controls_tfull' ``var'_int_e_controls' if endline_presence == 1, robust cl(hc_id) a(district)
		local n_dd_`x' = `e(N)'
		local b_dd_`x' = string(_b[t_16],"%9.3fc")
		local se_dd_`x' =string(_se[t_16],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[t_16]/_se[t_16])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local b_dd_`x' `b_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local b_dd_`x' `b_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local b_dd_`x' `b_dd_`x''***
		}
		
		local csb_dd_`x' = string(_b[_cons],"%9.3fc")
		local csse_dd_`x' =string(_se[_cons],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local csb_dd_`x' `csb_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local csb_dd_`x' `csb_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local csb_dd_`x' `csb_dd_`x''***
		}
		
		}
		
	eststo clear
			
	foreach x in `intermediate_hclevel' {
		areg `x' t_16 y16 b_`x'_d `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		local n_dd_`x' = `e(N)'
		local b_dd_`x' = string(_b[t_16],"%9.3fc")
		local se_dd_`x' =string(_se[t_16],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[t_16]/_se[t_16])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local b_dd_`x' `b_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local b_dd_`x' `b_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local b_dd_`x' `b_dd_`x''***
		}
		
		local csb_dd_`x' = string(_b[_cons],"%9.3fc")
		local csse_dd_`x' =string(_se[_cons],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local csb_dd_`x' `csb_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local csb_dd_`x' `csb_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local csb_dd_`x' `csb_dd_`x''***
		}
		
		}
		
	texdoc init "${tables}/TableI29.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \footnotesize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Robustness checks -- Intermediate outcomes}
	tex \begin{tabular}{lgggggggg}
	tex \toprule
	tex 										  & (1)                       & (2)                                                          & (3)                                                             & (4)                                                        & (5)                       & (6)                                            \\
    tex                                & \textbf{\begin{tabular}[c]{@{}c@{}}Citizen \\ knowledge\end{tabular}}      & \textbf{\begin{tabular}[c]{@{}c@{}}HC staff \\ knowledge\end{tabular}} & \textbf{Efficacy} & \textbf{\begin{tabular}[c]{@{}c@{}}Community \\ responsibility\end{tabular}}   & \textbf{Relationship} & \textbf{\begin{tabular}[c]{@{}c@{}}HC \\ transparency\end{tabular}}     \\
	tex \midrule
	tex \textit{A: Without control variables} \\
	tex \multirow{2}{*}{Program impact}   &`b_nocon_ctzknow_z'           & `b_nocon_h_hcpknow_z'                                                            & `b_nocon_eff_z'                                                               & `b_nocon_commresp_z'                                                           & `b_nocon_relhhhc_z' & `b_nocon_h_hctrans_z'         \\
	tex  & (`se_nocon_ctzknow_z')           & (`se_nocon_h_hcpknow_z')                                                            & (`se_nocon_eff_z')                                                               & (`se_nocon_commresp_z')                                                           & (`se_nocon_relhhhc_z') & (`se_nocon_h_hctrans_z')        \\
	tex \multirow{2}{*}{Constant}   &`csb_nocon_ctzknow_z'           & `csb_nocon_h_hcpknow_z'                                                            & `csb_nocon_eff_z'                                                               & `csb_nocon_commresp_z'                                                           & `csb_nocon_relhhhc_z' & `csb_nocon_h_hctrans_z'         \\
	tex  & (`csse_nocon_ctzknow_z')           & (`csse_nocon_h_hcpknow_z')                                                            & (`csse_nocon_eff_z')                                                               & (`csse_nocon_commresp_z')                                                          & (`csse_nocon_relhhhc_z') & (`csse_nocon_h_hctrans_z')        \\
	tex \\
	tex \textit{B: Without district fixed effects} \\
	tex \multirow{2}{*}{Program impact}   &`b_nofe_ctzknow_z'           & `b_nofe_h_hcpknow_z'                                                            & `b_nofe_eff_z'                                                               & `b_nofe_commresp_z'                                                           & `b_nofe_relhhhc_z' & `b_nofe_h_hctrans_z'        \\
	tex  & (`se_nofe_ctzknow_z')           & (`se_nofe_h_hcpknow_z')                                                            & (`se_nofe_eff_z')                                                               & (`se_nofe_commresp_z')                                                          & (`se_nofe_relhhhc_z') & (`se_nofe_h_hctrans_z')        \\
	tex \multirow{2}{*}{Constant}   &`csb_nofe_ctzknow_z'           & `csb_nofe_h_hcpknow_z'                                                            & `csb_nofe_eff_z'                                                               & `csb_nofe_commresp_z'                                                          & `csb_nofe_relhhhc_z' & `csb_nofe_h_hctrans_z'      \\
	tex  & (`csse_nofe_ctzknow_z')           & (`csse_nofe_h_hcpknow_z')                                                            & (`csse_nofe_eff_z')                                                               & (`csse_nofe_commresp_z')                                                           & (`csse_nofe_relhhhc_z') & (`csse_nofe_h_hctrans_z')      \\
	tex \\ 
	tex \textit{C: Without ouctome measures aggregated at HC level} \\
	tex \multirow{2}{*}{Program impact}   &`b_mean_ctzknow_z'           & `b_mean_h_hcpknow_z'                                                            & `b_mean_eff_z'                                                               & `b_mean_commresp_z'                                                          & `b_mean_relhhhc_z' & `b_mean_h_hctrans_z'        \\
	tex  & (`se_mean_ctzknow_z')           & (`se_mean_h_hcpknow_z')                                                            & (`se_mean_eff_z')                                                               & (`se_mean_commresp_z')                                                           & (`se_mean_relhhhc_z') & (`se_mean_h_hctrans_z')        \\
	tex \multirow{2}{*}{Constant}   &`csb_mean_ctzknow_z'           & `csb_mean_h_hcpknow_z'                                                            & `csb_mean_eff_z'                                                               & `csb_mean_commresp_z'                                                          & `csb_mean_relhhhc_z' & `csb_mean_h_hctrans_z'       \\
	tex  & (`csse_mean_ctzknow_z')           & (`csse_mean_h_hcpknow_z')                                                            & (`csse_mean_eff_z')                                                               & (`csse_mean_commresp_z')                                                          & (`csse_mean_relhhhc_z') & (`csse_mean_h_hctrans_z')       \\
	tex \\ 
	tex \textit{D: Difference between post and pre-treatment values} \\
	tex \multirow{2}{*}{Program impact}   &`b_dd_ctzknow_z'           & `b_dd_h_hcpknow_z'                                                            & `b_dd_eff_z'                                                               & `b_dd_commresp_z'                                                          & `b_dd_relhhhc_z' & `b_dd_h_hctrans_z'         \\
	tex  & (`se_dd_ctzknow_z')           & (`se_dd_h_hcpknow_z')                                                            & (`se_dd_eff_z')                                                               & (`se_dd_commresp_z')                                                          & (`se_dd_relhhhc_z') & (`se_dd_h_hctrans_z')          \\
	tex \multirow{2}{*}{Constant}   &`csb_dd_ctzknow_z'           & `csb_dd_h_hcpknow_z'                                                            & `csb_dd_eff_z'                                                               & `csb_dd_commresp_z'                                                          & `csb_dd_relhhhc_z' & `csb_dd_h_hctrans_z'         \\
	tex  & (`csse_dd_ctzknow_z')           & (`csse_dd_h_hcpknow_z')                                                            & (`csse_dd_eff_z')                                                               & (`csse_dd_commresp_z')                                                          & (`csse_dd_relhhhc_z') & (`csse_dd_h_hctrans_z')         \\
	tex \midrule
	tex Observations (A \& B)  &`n_nocon_ctzknow_z'           & `n_nocon_h_hcpknow_z'                                                            & `n_nocon_eff_z'                                                               & `n_nocon_commresp_z'                                                          & `n_nocon_relhhhc_z' & `n_nocon_h_hctrans_z'         \\
	tex Observations (C) & `n_mean_ctzknow_z'           & `n_mean_h_hcpknow_z'                                                            & `n_mean_eff_z'                                                               & `n_mean_commresp_z'                                                          & `n_mean_relhhhc_z' & `n_mean_h_hctrans_z'         \\
	tex Observations (D) & `n_dd_ctzknow_z'           & `n_dd_h_hcpknow_z'                                                            & `n_dd_eff_z'                                                               & `n_dd_commresp_z'                                                         & `n_dd_relhhhc_z' & `n_dd_h_hctrans_z'         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	*************************************************
	* Table I30: Child mortality at the child level *
	*************************************************

	* We load the dataset
	
	use "${usedata}/mortality_endline_ind.dta", clear
	
	***************
	* Regressions *
	***************
	
	**********************************************************
	** Controlvar corresponds to the main control variables **
	**********************************************************
	
	* All the variable are measured at baseline
		* health center is a health center II: hc2
		* health center is providing a official delivery services: b_h_del
		* health center has a staff house: b_h_staff_houses  ||| We dropped this variable because there was no variation (only 4 HCs without any staff houses)
		* the household declared to have visited the health center: b_visited_d
		* years of education of the interviewed head of HH: educyr
		* households asset index: b_assetindex
	
	* We set up the control variable local including the different bracket of the child mortality
	
	local controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
	
	local controls
	local controls_tfull
	
	foreach bracket in 01 12 23 34 45 05 15 {
		local controls_tfull`bracket'
		local controls_`bracket'
		}

	foreach var in treatfull treatinter treatinfo fullomn infomn intomn{
		local `var'_int_controls
		}
		
	foreach bracket in 01 12 23 34 45 05 15 {
		foreach var in treatfull treatinter treatinfo infint fullomn infomn intomn {
			local `var'_`bracket'_controls
			}
		}
		
	* We populate the control variable local including the different bracket of the child mortality
	
	foreach var of local controls_noprefix {
		local controls `controls' c_`var'
		}
	
	
	foreach var of local controls_noprefix {
		local controls_tfull `controls_tfull' c_tfull_`var'
		}
		
	foreach bracket in 01 12 23 34 45 05 15 {
		foreach var of local controls_noprefix {
			local controls_tfull`bracket' `controls_tfull`bracket'' c_tfull`bracket'_`var'
			local controls_`bracket' `controls_`bracket'' c_`bracket'_`var'
			}
		}

	foreach treat in treatfull treatinter treatinfo fullomn infomn intomn {
		foreach var of local controls_noprefix {
			local `treat'_int_controls ``treat'_int_controls' c_`treat'_`var'
			}
		}
		
	foreach bracket in 01 12 23 34 45 05 15 {
		foreach treat in treatfull treatinfo treatinter infint fullomn infomn intomn {
			foreach var of local controls_noprefix {
				local `treat'_`bracket'_controls ``treat'_`bracket'_controls' c_`treat'`bracket'_`var'
				}
			}
		}
	
	* Checking all locals are defined:
	
	foreach bracket in 05 01 15 {
		sum `controls_tfull`bracket'' 
		}
	
	foreach bracket in 05 01 15 {
		sum `treatfull_`bracket'_controls' 
		}
	foreach bracket in 05 01 15 {
		sum e_calendermonth_ab_`bracket'  
		}
		
	foreach bracket in 05 01 15 {
		sum e_agebracket_`bracket'
		}
		
	foreach bracket in 05 01 15 {
		sum e_survmonths_ab_`bracket'
		}
		
	* We regress the results at endline for each bracket concerned in the PAP
	
	* Full treatment with birth month and synthetic cohort approach baseline HC level and no district FE
	
	eststo clear
	
	local y = 1
	foreach bracket in 05 01 15{
		stset e_survmonths_ab_`bracket', failure(dead_endline==1) id(childroster_id)
		stcox treatfull `controls_tfull`bracket'' `treatfull_`bracket'_controls' e_birthmonth b_mortrate_`bracket' if e_agebracket_`bracket' == 1, vce(cluster hc_id)
		estimate store m`y'
	
		stphtest, detail
		
		local y = `y' + 1
		}
	
	* We compute the adjusted p-value
	
	estimates restore m1
	estadd scalar adj_p = 0.900
	
	estimates restore m2
	estadd scalar adj_p = 0.515
	
	estimates restore m3
	estadd scalar adj_p = 0.450
	
	* We outsheet the results
	
	# delimit;
	
	esttab m1 m2 m3
	using "${tables}/TableI30.tex", b(%5.3f) se(%5.3f) eform
		title(Child mortality at the child level)
		keep(treatfull)
		varlabels (treatfull "Full treatment")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}0-5 years old\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}0-1 year old\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}1-5 years old\end{tabular}}")
		stats(N adj_p, labels("N" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	**********************************************************
	* Table I31: Main outcomes – Principal component indices *
	**********************************************************
	
	* &
	
	******************************************************************
	* Table I32: Intermediate outcomes – Principal component indices *
	******************************************************************
	
	* We load the dataset. This is the light version
	
	use "${usedata}/chp_el_light_dataset.dta", clear

	***********************
	** Utilization rates **
	***********************
		
	* We calculate the pca of the components listed below:
	
	* Utilization rates contains:
		* `x'_immunization
		* `x'_visit_hf
		* `x'_hf_otherpract
		
	foreach x in b e {
	
	* Settin up the assets 
		
	#delimit ;
	
	local `x'_urate `x'_immunization 
	`x'_visit_hf 
	`x'_hf_otherpract
	
	;
	#delimit cr
				
	* Transform variables with long upper tail 
	
	foreach var of local `x'_urate {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_urate_sqrt
	
	foreach var of local `x'_urate{
		local `x'_urate_sqrt ``x'_urate_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_urate_sqrt' if treatfull != ., com(1)
	predict `x'_var
	egen `x'_urate = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_urate "Asset index at `x'"
	local remain `remain' `x'_urate
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_urate_sqrt{
		drop `z'
		}
	}
	
	* We calculate the urate pca if for the non-child subsample
	
	foreach x in b e {
	
	* Settin up the assets 
		
	#delimit ;
	
	local `x'_urate `x'_visit_hf 
	`x'_hf_otherpract
	
	;
	#delimit cr
				
	* Transform variables with long upper tail 
	
	foreach var of local `x'_urate {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_urate_sqrt
	
	foreach var of local `x'_urate{
		local `x'_urate_sqrt ``x'_urate_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_urate_sqrt' if treatfull != ., com(1)
	predict `x'_var
	egen `x'_urate_nc = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_urate_nc "Asset index at `x'"
	local remain `remain' `x'_urate_nc
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_urate_sqrt{
		drop `z'
		}
	}
	
	foreach x in b e {
		replace `x'_urate = `x'_urate_nc if `x'_urate == . & treatfull != .
		drop `x'_urate_nc
		}
		
	* We create the 10% dummy variable
		
	qui mdesc b_urate if treatfull != .
	gen b_urate_d = (b_urate == . & `r(percent)' >= 10 & treatfull != .)
	lab var b_urate_d "1 if the variable is missing at more than 10%"
	local remain `remain' b_urate_d
	
	***********************
	** Treatment quality **
	***********************
	
	* We calculate the average of the components listed below:
	
	* The index contains:
		*`x'_use_equip
		*`x'_trained
		*`x'_exam_privacy
		*`x'_taketest
		*`x'_diagnosis_explained
		*`x'_percentstaff_sv
		*`x'_cleanliness
		*`x'_meanstock
			
	foreach x in b e {
	
	* Settin up the assets 
		
	#delimit ;
	
	local `x'_treatqual `x'_use_equip
	`x'_trained
	`x'_exam_privacy
	`x'_taketest
	`x'_diagnosis_explained
	`x'_h_percentstaff_sv
	`x'_h_cleanliness
	`x'_h_meanstock
	
	;
	#delimit cr
				
	* Transform variables with long upper tail 
	
	foreach var of local `x'_treatqual {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_treatqual_sqrt
	
	foreach var of local `x'_treatqual{
		local `x'_treatqual_sqrt ``x'_treatqual_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_treatqual_sqrt' if treatfull != . , com(1)
	predict `x'_var
	egen `x'_treatqual = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_treatqual "Asset index at `x'"
	local remain `remain' `x'_treatqual
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_treatqual_sqrt{
		drop `z'
		}
	}
		
	* We create the 10% dummy variable
		
	qui mdesc b_treatqual if treatfull != .
	gen b_treatqual_d = (b_treatqual == . & `r(percent)' >= 10 & treatfull != .)
	lab var b_treatqual_d "1 if the variable is missing at more than 10%"
	local remain `remain' b_treatqual_d
	
	**************************
	** Patient satisfaction **
	**************************
	
	* We calculate the average of the components listed below:
	
	* The index contains:
		*`x'_qualityhc
		*`x'_qualitycare
		*`x'_politestaff
		*`x'_interest_health
		*`x'_stafflistening
		*`x'_freeexpress
		*`x'_yearb_avail
		
	foreach x in e {
	
	* Settin up the assets 
		
	#delimit ;
	
	local `x'_patsat `x'_qualityhc_d
	`x'_qualitycare
	`x'_politestaff
	`x'_interest_health
	`x'_stafflistening
	`x'_freeexpress
	`x'_yearb_avail
	
	;
	#delimit cr
				
	* Transform variables with long upper tail 
	
	foreach var of local `x'_patsat {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_patsat_sqrt
	
	foreach var of local `x'_patsat{
		local `x'_patsat_sqrt ``x'_patsat_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_patsat_sqrt' if treatfull != . , com(1)
	predict `x'_var
	egen `x'_patsat = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_patsat "Asset index at `x'"
	local remain `remain' `x'_patsat
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_patsat_sqrt{
		drop `z'
		}
	}
	
	foreach x in b {
	
	* Settin up the assets 
		
	#delimit ;
	
	local `x'_patsat `x'_qualitycare
	`x'_politestaff
	`x'_interest_health
	`x'_stafflistening
	`x'_freeexpress
	`x'_yearb_avail
	
	;
	#delimit cr
				
	* Transform variables with long upper tail 
	
	foreach var of local `x'_patsat {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_patsat_sqrt
	
	foreach var of local `x'_patsat{
		local `x'_patsat_sqrt ``x'_patsat_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_patsat_sqrt' if treatfull != . , com(1)
	predict `x'_var
	egen `x'_patsat = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_patsat "Asset index at `x'"
	local remain `remain' `x'_patsat
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_patsat_sqrt{
		drop `z'
		}
	}
		
	* We create the 10% dummy variable
		
	qui mdesc b_patsat if treatfull != .
	gen b_patsat_d = (b_patsat == . & `r(percent)' >= 10 & treatfull != .)
	lab var b_patsat_d "1 if the variable is missing at more than 10%"
	local remain `remain' b_patsat_d
	
	**********************************
	** Health Outcomes with height  **
	**********************************
	
	* We calculate the average of the components listed below:
	
	* The index contains:
		*`x'_weight_18m
		*`x'_weight_36m
		*`x'_muac_18m
		*`x'_muac_36m
		
	foreach x in b e {
	
	* Settin up the assets 
		
	#delimit ;
	
	local `x'_healthout `x'_weight_18m
	`x'_weight_36m
	`x'_muac_18m
	`x'_muac_36m
	
	;
	#delimit cr
				
	* Transform variables with long upper tail 
	
	foreach var of local `x'_healthout {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_healthout_sqrt
	
	foreach var of local `x'_healthout{
		local `x'_healthout_sqrt ``x'_healthout_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_healthout_sqrt' if treatfull != ., com(1)
	predict `x'_var
	egen `x'_healthout = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_healthout "Asset index at `x'"
	local remain `remain' `x'_healthout
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_healthout_sqrt{
		drop `z'
		}
	}
	
	foreach x in b e {
	
	* Settin up the assets 
		
	#delimit ;
	
	local `x'_healthout `x'_weight_18m
	`x'_muac_18m
	
	;
	#delimit cr
				
	* Transform variables with long upper tail 
	
	foreach var of local `x'_healthout {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_healthout_sqrt
	
	foreach var of local `x'_healthout{
		local `x'_healthout_sqrt ``x'_healthout_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_healthout_sqrt' if treatfull != ., com(1)
	predict `x'_var
	egen `x'_healthout18 = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_healthout18 "Asset index at `x'"
	local remain `remain' `x'_healthout18
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_healthout_sqrt{
		drop `z'
		}
	}
	
	foreach x in b e {
	
	* Settin up the assets 
		
	#delimit ;
	
	local `x'_healthout `x'_weight_36m
	`x'_muac_36m
	
	;
	#delimit cr
				
	* Transform variables with long upper tail 
	
	foreach var of local `x'_healthout {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_healthout_sqrt
	
	foreach var of local `x'_healthout{
		local `x'_healthout_sqrt ``x'_healthout_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_healthout_sqrt' if treatfull != ., com(1)
	predict `x'_var
	egen `x'_healthout36 = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_healthout36 "Asset index at `x'"
	local remain `remain' `x'_healthout18
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_healthout_sqrt{
		drop `z'
		}
	}
	
	foreach x in b e {
		replace `x'_healthout = `x'_healthout18 if `x'_healthout == . & `x'_healthout18 != .
		}
		
	foreach x in b e {
		replace `x'_healthout = `x'_healthout36 if `x'_healthout == . & `x'_healthout36 != .
		}
		
	* We create the 10% dummy variable
		
	qui mdesc b_healthout if treatfull != .
	gen b_healthout_d = (b_healthout == . & `r(percent)' >= 10 & treatfull != .)
	lab var b_healthout_d "1 if the variable is missing at more than 10%"
	local remain `remain' b_healthout_d
	
	**********************
	** Child mortality  **
	**********************
	
	* Child mortality is not an indices so no PCA
	
	***********************
	** Citizen knowledge **
	***********************
	
	* We calculate the average of the components listed below:
	
	* The index contains:
		*`x'_numrights_hh
		*`x'_numresp_hh
		*`x'_services_hh
		
	* Settin up the assets 
		
	
	foreach x in e {
	
	#delimit ;
	
	local `x'_ctzknow `x'_numrights_hh
	`x'_numresp_hh
	`x'_services_hh
	
	;
	#delimit cr
	
	* Transform variables with long upper tail 
	
	foreach var of local `x'_ctzknow {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_ctzknow_sqrt
	
	foreach var of local `x'_ctzknow{
		local `x'_ctzknow_sqrt ``x'_ctzknow_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_ctzknow_sqrt' if treatfull != . , com(1)
	predict `x'_var
	egen `x'_ctzknow = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_ctzknow "Asset index at `x'"
	local remain `remain' `x'_ctzknow
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_ctzknow_sqrt{
		drop `z'
		}
		
	}
	
	foreach x in b {
	
	#delimit ;
	
	local `x'_ctzknow `x'_numrights_hh
	`x'_numresp_hh
	
	;
	#delimit cr
	
	* Transform variables with long upper tail 
	
	foreach var of local `x'_ctzknow {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_ctzknow_sqrt
	
	foreach var of local `x'_ctzknow{
		local `x'_ctzknow_sqrt ``x'_ctzknow_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_ctzknow_sqrt' if treatfull != . , com(1)
	predict `x'_var
	egen `x'_ctzknow = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_ctzknow "Asset index at `x'"
	local remain `remain' `x'_ctzknow
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_ctzknow_sqrt{
		drop `z'
		}
		
	}
	
	* We create the 10% dummy variable
		
	qui mdesc b_ctzknow if treatfull != .
	gen b_ctzknow_d = (b_ctzknow == . & `r(percent)' >= 10 & treatfull != .)
	lab var b_ctzknow_d "1 if the variable is missing at more than 10%"
	local remain `remain' b_ctzknow_d
	
	************************************
	** Health care provider knowledge **
	************************************
	
	* We calculate the average of the components listed below:
	
	* The index contains:
		*`x'_numrights
		*`x'_numresp
		
	* Settin up the assets 
	
	foreach x in b e {
	
	#delimit ;
	
	local `x'_hcpknow `x'_h_numrights
	`x'_h_numresp
	
	;
	#delimit cr
	
	* Transform variables with long upper tail 
	
	foreach var of local `x'_hcpknow {
		gen `var'_sqrt = sqrt(`var') if uniquehc == 1 & treatfull != .
		}
	
	local `x'_hcpknow_sqrt
	
	foreach var of local `x'_hcpknow{
		local `x'_hcpknow_sqrt ``x'_hcpknow_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_hcpknow_sqrt' if uniquehc == 1 & treatfull != . , com(1)
	predict `x'_var
	egen `x'_hcpknow = std(`x'_var) if uniquehc == 1 & treatfull != .
	drop `x'_var
	
	lab var `x'_hcpknow "Asset index at `x'"
	local remain `remain' `x'_hcpknow
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_hcpknow_sqrt{
		drop `z'
		}
	}
		
	* We create the 10% dummy variable
		
	qui mdesc b_hcpknow if uniquehc == 1 & treatfull != .
	gen b_hcpknow_d = (b_hcpknow == . & `r(percent)' >= 10 & uniquehc == 1 & treatfull != .)
	lab var b_hcpknow_d "1 if the variable is missing at more than 10%"
	local remain `remain' b_hcpknow_d
	
	**********************
	** Citizen pressure **
	**********************
	
	* We calculate the average of the components listed below:
	
	* The index contains:
		*`x'_wrong_z
		*`x'_pressure_z
		*`x'_hw_report_z
		
	* Settin up the assets 
	
	foreach x in e {
	
	#delimit ;
	
	local `x'_h_ctzpressure `x'_h_wrong `x'_h_pressure `x'_h_hw_report

	;
	#delimit cr
	
	* Transform variables with long upper tail 
	
	foreach var of local `x'_h_ctzpressure {
		gen `var'_sqrt = sqrt(`var') if uniquehc == 1 & treatfull != .
		}
		
	
	local `x'_h_ctzpressure_sqrt
	
	foreach var of local `x'_h_ctzpressure {
		local `x'_h_ctzpressure_sqrt ``x'_h_ctzpressure_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_h_ctzpressure_sqrt' if uniquehc == 1 & treatfull != . , com(1)
	predict `x'_var
	egen `x'_h_ctzpressure = std(`x'_var) if uniquehc == 1 & treatfull != .
	drop `x'_var
	
	lab var `x'_h_ctzpressure "Asset index at `x'"
	local remain `remain' `x'_h_ctzpressure
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_h_ctzpressure_sqrt{
		drop `z'
		}
	}

	* Settin up the assets 
	
	foreach x in b {
	
	#delimit ;
	
	local `x'_h_ctzpressure `x'_h_wrong `x'_h_pressure

	;
	#delimit cr
	
	* Transform variables with long upper tail 
	
	foreach var of local `x'_h_ctzpressure {
		gen `var'_sqrt = sqrt(`var') if uniquehc == 1 & treatfull != .
		}
	
	local `x'_h_ctzpressure_sqrt
	
	foreach var of local `x'_h_ctzpressure {
		local `x'_h_ctzpressure_sqrt ``x'_h_ctzpressure_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_h_ctzpressure_sqrt' if uniquehc == 1 & treatfull != . , com(1)
	predict `x'_var
	egen `x'_h_ctzpressure = std(`x'_var) if uniquehc == 1 & treatfull != .
	drop `x'_var
	
	lab var `x'_h_ctzpressure "Asset index at `x'"
	local remain `remain' `x'_h_ctzpressure
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_h_ctzpressure_sqrt{
		drop `z'
		}
	}
		
	* We create the 10% dummy variable
		
	qui mdesc b_h_ctzpressure if uniquehc == 1 & treatfull != .
	gen b_h_ctzpressure_d = (b_h_ctzpressure == . & `r(percent)' >= 10 & uniquehc == 1 & treatfull != .)
	lab var b_h_ctzpressure_d "1 if the variable is missing at more than 10%"
	local remain `remain' b_h_ctzpressure_d
	
	********************
	** Efficacy index **
	********************
	
	* We calculate the average of the components listed below:
	
	* The index contains:
		*`x'_power
		*`x'_pressure_effort
		*`x'_pressure_report
		*`x'_influence
		*`x'_peoplesay_gov
		*`x'_peoplesay_hc
		
	* Settin up the assets 
	
	foreach x in e {
	
	#delimit ;
	
	local `x'_eff `x'_power
	`x'_pressure_effort
	`x'_pressure_report
	`x'_influence
	`x'_peoplesay_gov
	`x'_peoplesay_hc
	
	;
	#delimit cr
	
	* Transform variables with long upper tail 
	
	foreach var of local `x'_eff {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_eff_sqrt
	
	foreach var of local `x'_eff{
		local `x'_eff_sqrt ``x'_eff_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_eff_sqrt' if treatfull != ., com(1)
	predict `x'_var
	egen `x'_eff = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_eff "Asset index at `x'"
	local remain `remain' `x'_eff
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_eff_sqrt{
		drop `z'
		}
		
	}
	
	foreach x in b {
	
	#delimit ;
	
	local `x'_eff `x'_power
	`x'_influence
	`x'_peoplesay_gov
	`x'_peoplesay_hc
	
	;
	#delimit cr
	
	* Transform variables with long upper tail 
	
	foreach var of local `x'_eff {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_eff_sqrt
	
	foreach var of local `x'_eff{
		local `x'_eff_sqrt ``x'_eff_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_eff_sqrt' if treatfull != ., com(1)
	predict `x'_var
	egen `x'_eff = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_eff "Asset index at `x'"
	local remain `remain' `x'_eff
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_eff_sqrt{
		drop `z'
		}
		
	}
	
	* We create the 10% dummy variable
		
	qui mdesc b_eff if treatfull != .
	gen b_eff_d = (b_eff == . & `r(percent)' >= 10 & treatfull != .)
	lab var b_eff_d "1 if the variable is missing at more than 10%"
	local remain `remain' b_eff_d
	
	******************************
	** Community responsability **
	******************************
	
	* We calculate the average of the components listed below:
	
	* The index contains:
		*`x'_responsible
		*`x'_commembers_resp
		
		
	foreach x in b e {
	
	#delimit ;
	
	local `x'_commresp `x'_responsible
	`x'_commembers_resp
	
	;
	#delimit cr
	
	* Transform variables with long upper tail 
	
	foreach var of local `x'_commresp {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_commresp_sqrt
	
	foreach var of local `x'_commresp{
		local `x'_commresp_sqrt ``x'_commresp_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_commresp_sqrt' if treatfull != ., com(1)
	predict `x'_var
	egen `x'_commresp = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_commresp "Asset index at `x'"
	local remain `remain' `x'_commresp
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_commresp_sqrt{
		drop `z'
		}
		
	}
	
	* We create the 10% dummy variable
		
	qui mdesc b_commresp if treatfull != .
	gen b_commresp_d = (b_commresp == . & `r(percent)' >= 10 & treatfull != .)
	lab var b_commresp_d "1 if the variable is missing at more than 10%"
	local remain `remain' b_commresp_d
	
	**************************
	** Community monitoring **
	**************************
	
	* We calculate the average of the components listed below:
	
	* The index contains:
		*`x'_lc1_meetings
		*`x'_lc1_meetings_hc 
		*`x'_find_report
		*`x'_find_effort
		
	foreach x in e {
	
	#delimit ;
	
	local `x'_commtg `x'_lc1_meetings
	`x'_lc1_meetings_hc 
	`x'_find_report
	`x'_find_effort
	
	;
	#delimit cr
	
	* Transform variables with long upper tail 
	
	foreach var of local `x'_commtg {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_commtg_sqrt
	
	foreach var of local `x'_commtg{
		local `x'_commtg_sqrt ``x'_commtg_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_commtg_sqrt' if treatfull != ., com(1)
	predict `x'_var
	egen `x'_commtg = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_commtg "Asset index at `x'"
	local remain `remain' `x'_commtg
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_commtg_sqrt{
		drop `z'
		}
		
	}
	
	foreach x in b {
	
	#delimit ;
	
	local `x'_commtg `x'_lc1_meetings
	`x'_lc1_meetings_hc 
	;
	#delimit cr
	
	* Transform variables with long upper tail 
	
	foreach var of local `x'_commtg {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_commtg_sqrt
	
	foreach var of local `x'_commtg{
		local `x'_commtg_sqrt ``x'_commtg_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_commtg_sqrt' if treatfull != ., com(1)
	predict `x'_var
	egen `x'_commtg = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_commtg "Asset index at `x'"
	local remain `remain' `x'_commtg
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_commtg_sqrt{
		drop `z'
		}
		
	}
	
	* We create the 10% dummy variable
		
	qui mdesc b_commtg if treatfull != .
	gen b_commtg_d = (b_commtg == . & `r(percent)' >= 10 & treatfull != .)
	lab var b_commtg_d "1 if the variable is missing at more than 10%"
	local remain `remain' b_commtg_d
	
	******************************************************
	** Relationship between Health Center and Community **
	******************************************************
	
	* We calculate the average of the components listed below:
	
	* The index contains:
		*`x'_sat_rel 
		*`x'_trust_hw 
		*`x'_satisfiedrel 
		*`x'_complain
	
	foreach x in b e {
	
	#delimit ;
	
	local `x'_relhhhc `x'_sat_rel 
	`x'_trust_hw 
	`x'_h_satisfiedrel 
	`x'_complain
	
	;
	#delimit cr
	
	* Transform variables with long upper tail 
	
	foreach var of local `x'_relhhhc {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_relhhhc_sqrt
	
	foreach var of local `x'_relhhhc{
		local `x'_relhhhc_sqrt ``x'_relhhhc_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_relhhhc_sqrt' if treatfull != ., com(1)
	predict `x'_var
	egen `x'_relhhhc = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_relhhhc "Asset index at `x'"
	local remain `remain' `x'_relhhhc
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_relhhhc_sqrt{
		drop `z'
		}
		
	}
	
	* We create the 10% dummy variable
		
	qui mdesc b_relhhhc if treatfull != .
	gen b_relhhhc_d = (b_relhhhc == . & `r(percent)' >= 10 & treatfull != .)
	lab var b_relhhhc_d "1 if the variable is missing at more than 10%"
	local remain `remain' b_relhhhc_d
	
	********************************
	** Health Center Transparency **
	********************************
	
	* We calculate the average of the components listed below:
	
	* The index contains:
		*`x'_opening_posters
		*`x'_dutyroster
		*`x'_sugbox
		*`x'_infoservice
		*`x'_infoprights
	
	foreach x in b e {
	
	#delimit ;
	
	local `x'_hctrans `x'_h_opening_posters
	`x'_h_dutyroster
	`x'_h_sugbox
	`x'_h_infoservice
	`x'_h_infoprights
	
	;
	#delimit cr
	
	* Transform variables with long upper tail 
	
	foreach var of local `x'_hctrans {
		gen `var'_sqrt = sqrt(`var') if treatfull != .
		}
	
	local `x'_hctrans_sqrt
	
	foreach var of local `x'_hctrans{
		local `x'_hctrans_sqrt ``x'_hctrans_sqrt' `var'_sqrt
		}
	
	* Implementing PCA technic
	
	* Using correlation matrix by default, so different units are not an issue
						
	pca ``x'_hctrans_sqrt' if treatfull != ., com(1)
	predict `x'_var
	egen `x'_hctrans = std(`x'_var) if treatfull != .
	drop `x'_var
	
	lab var `x'_hctrans "Asset index at `x'"
	local remain `remain' `x'_hctrans
						
	* We calculate it there as it only concerns baseline.
	
	* We drop useless variable
	
	foreach z of local `x'_hctrans_sqrt{
		drop `z'
		}
		
	}
	
	* We create the 10% dummy variable
		
	qui mdesc b_hctrans if treatfull != .
	gen b_hctrans_d = (b_hctrans == . & `r(percent)' >= 10 & treatfull != .)
	lab var b_hctrans_d "1 if the variable is missing at more than 10%"
	local remain `remain' b_hctrans_d
	
	*********************
	** Creating locals **
	*********************

	* We create it for endline and baseline and one only irrespective to the timeline

	local indices commtg h_ctzpressure urate treatqual patsat
	local indices_ho healthout
	
	local intermediate ctzknow eff commresp relhhhc
	local intermediate_hclevel hcpknow hctrans
	
	***************
	* Regressions *
	***************
	
	* In this part we run the regressions
	
	eststo clear
	
	* Then, we move to the regressions by treatment
	
	* At endline:
	
	eststo clear
	
	local var treatfull
	
	* We regress our main indices
	
	local y = 1
	foreach x in `indices' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		estimates store m`y'
		local y = `y' + 1
		}
		
	local y = 6
	foreach x in `indices_ho' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull_hoe' `tfulli_hoe_e_controls', robust cl(hc_id) a(district)
		estimates store m`y'
		}
		
	
	* We create the plot concerning the results of the main indices
	
	*********************************
	* Table Main outcomes (Endline) *
	*********************************
	
	* Outsheeting in the table folder and final appendix folder
	
	# delimit;
	
	esttab m1 m2 m3 m4 m5 m6
	using "${tables}/TableI31.tex", b(%5.3f) se(%5.3f)
		title(Main outcomes PCA calcul: Averaged z-score indices)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Citizen\\monitoring\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Perceived\\citizen\\pressure\end{tabular}}"
				"\textbf{Utilization}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Treatment\\quality\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Patient\\satisfaction\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Health\\outcomes\end{tabular}}")
		stats(N r2, labels("N" "R$^{2}$") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	
	***************************
	** Intermediate outcomes **
	***************************
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `intermediate' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		estimates store m`y'
		local y = `y' + 1
		}
		
	local y = 6
	foreach x in `intermediate_hclevel' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		estimates store m`y'
		local y = `y' + 1
		}
	
	*****************************************
	* Table Intermediate outcomes (Endline) *
	*****************************************
	
	# delimit;
	
	esttab m1 m6 m2 m3 m4 m7
	using "${tables}/TableI32.tex", b(%5.3f) se(%5.3f)
		title(Intermediate outcomes PCA calcul: Averaged z-score indices)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Citizen\\knowledge\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}HC staff\\knowledge\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Efficacy\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Community\\responsibility\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Relationship\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}HC\\transparency\end{tabular}}")
		stats(N r2, labels("N" "R$^{2}$") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	********************************************************************************************
	* Table I34: Robustness checks – Main treatment quality outcomes with no HC subcomponentsl *
	********************************************************************************************
	
	* We load the dataset. This is the light version
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* In this part, we regress the outcomes over the full treatment vs control
	
	local var treatfull
	
	local indices urate_z treatqual_z treatqualalt_z patsat_z commtg_z
	
	local indices_hc h_ctzpressure_z mortrate_05
	
	* At endline:
	
	**************
	* No control *
	**************
	
	eststo clear

	foreach x in `indices' {
		areg  e_`x' `var' b_`x' b_`x'_d, robust cl(hc_id) a(district)
		local n_nocon_`x' = string(`e(N)',"%9.0fc")
		local b_nocon_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocon_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocon_`x' =string(_se[_cons],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local csb_nocon_`x' `csb_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local csb_nocon_`x' `csb_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local csb_nocon_`x' `csb_nocon_`x''***
		}
		
		}
	
	* We include child mortality indicator at hc level
	
	foreach x in `indices_hc' {
		areg  e_`x' `var' b_`x' if uniquehc == 1, robust a(district)
		local n_nocon_`x' = string(`e(N)',"%9.0fc")
		local b_nocon_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocon_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocon_`x' =string(_se[_cons],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local csb_nocon_`x' `csb_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local csb_nocon_`x' `csb_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local csb_nocon_`x' `csb_nocon_`x''***
		}
		
		}
		
	*********
	* No FE *
	*********
	
	* We define the control variable
	
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	foreach x in e_ {
	
		local `x'controls_tfull
		local `x'controls_tfull_hc
		
		}
		
	foreach x in e_ {
		foreach var in treatfull {
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			}
		}
		
	foreach var of local e_controls_noprefix {
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}	
				
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			}
		}
	
	
	eststo clear
	
	local var treatfull
	
	foreach x in `indices' {
		reg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', cl(hc_id) robust
		local n_nofe_`x' = string(`e(N)',"%9.0fc")
		local b_nofe_`x' = string(_b[treatfull],"%9.3fc")
		local se_nofe_`x' =string(_se[treatfull],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = string(_b[_cons],"%9.3fc")
		local csse_nofe_`x' =string(_se[_cons],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local csb_nofe_`x' `csb_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local csb_nofe_`x' `csb_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local csb_nofe_`x' `csb_nofe_`x''***
		}
		
		}
		
	foreach x in `indices_hc' {
		reg  e_`x' `var' b_`x' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust
		local n_nofe_`x' = string(`e(N)',"%9.0fc")
		local b_nofe_`x' = string(_b[treatfull],"%9.3fc")
		local se_nofe_`x' =string(_se[treatfull],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = string(_b[_cons],"%9.3fc")
		local csse_nofe_`x' =string(_se[_cons],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local csb_nofe_`x' `csb_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local csb_nofe_`x' `csb_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local csb_nofe_`x' `csb_nofe_`x''***
		}
		
		}
		
		
	*****************************
	* Added later: No Cov * Int *
	*****************************
	
	* We define the control variable
	
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	foreach x in e_ {
	
		local `x'controls_tfull
		local `x'controls_tfull_hc
		
		}
		
	foreach x in e_ {
		foreach var in treatfull {
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			}
		}
		
	foreach var of local e_controls_noprefix {
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}	
				
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			}
		}
	
	
	eststo clear
	
	local var treatfull
	
	foreach x in `indices' {
		areg  e_`x' `var' b_`x' b_`x'_d `e_controls_tfull' , cl(hc_id) robust a(district)
		local n_nocovint_`x' = string(`e(N)',"%9.0fc")
		local b_nocovint_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocovint_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocovint_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocovint_`x'' <= 0.1 & `p_nocovint_`x'' > 0.05{
			local b_nocovint_`x' `b_nocovint_`x''*
		}
	
		if `p_nocovint_`x'' <= 0.05 & `p_nocovint_`x'' > 0.01{
			local b_nocovint_`x' `b_nocovint_`x''**
		}
		
		if `p_nocovint_`x'' <= 0.01 & `p_nocovint_`x'' > 0 {
			local b_nocovint_`x' `b_nocovint_`x''***
		}
		
		local csb_nocovint_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocovint_`x' =string(_se[_cons],"%9.3fc")
		local p_nocovint_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocovint_`x'' <= 0.1 & `p_nocovint_`x'' > 0.05{
			local csb_nofe_`x' `csb_nocovint_`x''*
		}
	
		if `p_nocovint_`x'' <= 0.05 & `p_nocovint_`x'' > 0.01{
			local csb_nocovint_`x' `csb_nocovint_`x''**
		}
		
		if `p_nocovint_`x'' <= 0.01 & `p_nocovint_`x'' > 0 {
			local csb_nocovint_`x' `csb_nocovint_`x''***
		}
		
		}
	
		
	foreach x in `indices_hc' {
		areg  e_`x' `var' b_`x' `e_controls_tfull_hc' if uniquehc == 1, robust a(district)
		local n_nocovint_`x' = string(`e(N)',"%9.0fc")
		local b_nocovint_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocovint_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocovint_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocovint_`x'' <= 0.1 & `p_nocovint_`x'' > 0.05{
			local b_nocovint_`x' `b_nocovint_`x''*
		}
	
		if `p_nocovint_`x'' <= 0.05 & `p_nocovint_`x'' > 0.01{
			local b_nocovint_`x' `b_nocovint_`x''**
		}
		
		if `p_nocovint_`x'' <= 0.01 & `p_nocovint_`x'' > 0 {
			local b_nocovint_`x' `b_nocovint_`x''***
		}
		
		local csb_nocovint_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocovint_`x' =string(_se[_cons],"%9.3fc")
		local p_nocovint_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocovint_`x'' <= 0.1 & `p_nocovint_`x'' > 0.05{
			local csb_nocovint_`x' `csb_nocovint_`x''*
		}
	
		if `p_nocovint_`x'' <= 0.05 & `p_nocovint_`x'' > 0.01{
			local csb_nocovint_`x' `csb_nocovint_`x''**
		}
		
		if `p_nocovint_`x'' <= 0.01 & `p_nocovint_`x'' > 0 {
			local csb_nocovint_`x' `csb_nocovint_`x''***
		}
		
		}
		
	*************************
	* Agregated at HC level *
	*************************
	
	local indices_hc mortrate_05 h_ctzpressure_z
	
	* Our first step is to create the mean at HC level
	
	foreach x of local indices {
		byso hc_id : egen mean_e_`x' = mean(e_`x')
		byso hc_id : egen mean_b_`x' = mean(b_`x')
		byso hc_id : egen mean_b_`x'_d = mean(b_`x'_d)
		}
		
	foreach x of local indices_hc {
		byso hc_id : egen mean_e_`x' = mean(e_`x')
		byso hc_id : egen mean_b_`x' = mean(b_`x')
		}
	
	
	eststo clear
	
	local var treatfull
	
	foreach x in `indices' {
		areg  mean_e_`x' `var' mean_b_`x' mean_b_`x'_d `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		local n_mean_`x' = string(`e(N)',"%9.0fc")
		local b_mean_`x' = string(_b[treatfull],"%9.3fc")
		local se_mean_`x' =string(_se[treatfull],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local b_mean_`x' `b_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local b_mean_`x' `b_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local b_mean_`x' `b_mean_`x''***
		}
		
		local csb_mean_`x' = string(_b[_cons],"%9.3fc")
		local csse_mean_`x' =string(_se[_cons],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local csb_mean_`x' `csb_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local csb_mean_`x' `csb_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local csb_mean_`x' `csb_mean_`x''***
		}
		
		}

	eststo clear
			
	foreach x in `indices_hc' {
		areg  mean_e_`x' `var' mean_b_`x' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		local n_mean_`x' = string(`e(N)',"%9.0fc")
		local b_mean_`x' = string(_b[treatfull],"%9.3fc")
		local se_mean_`x' =string(_se[treatfull],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local b_mean_`x' `b_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local b_mean_`x' `b_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local b_mean_`x' `b_mean_`x''***
		}
		
		local csb_mean_`x' = string(_b[_cons],"%9.3fc")
		local csse_mean_`x' =string(_se[_cons],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local csb_mean_`x' `csb_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local csb_mean_`x' `csb_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local csb_mean_`x' `csb_mean_`x''***
		}
		
		}
		
	***********************************
	* Diff in Diff endline - baseline *
	***********************************
	
	local add_control
	
	foreach var of local indices {
		local add_control `add_control' b_`var'_d
		}
	
	local var treatfull
	
	local e_indices e_urate_z e_treatqual_z e_treatqualalt_z e_patsat_z e_commtg_z
	local e_indices_hc e_mortrate_05 e_h_ctzpressure_z
	
	local b_indices b_urate_z b_treatqual_z b_treatqualalt_z b_patsat_z b_commtg_z
	local b_indices_hc b_mortrate_05 b_h_ctzpressure_z
	
	keep hh_id hc_id `add_control' `b_indices' `b_indices_hc' `e_indices' `e_indices_hc' `e_controls_tfull' `e_controls_tfull_hc' ``var'_int_e_controls' ``var'_hc_int_e_controls' district uniquehc treatfull endline_presence
	
	foreach x of local indices {
		ren b_`x' `x'_b
		ren e_`x' `x'_e
		}
		
	foreach x of local indices_hc {
		ren b_`x' `x'_b
		ren e_`x' `x'_e
		}
		
	reshape long `indices' `indices_hc' , i(hh_id) j(num) s
	
	gen y16 = (num == "_e")
	
	drop num
	
	gen t_16 = treatfull*y16
	
	local indices urate_z treatqual_z treatqualalt_z patsat_z commtg_z
	
	foreach x in `indices' {
		areg `x' t_16 y16 b_`x'_d `e_controls_tfull' ``var'_int_e_controls' if endline_presence == 1, robust cl(hc_id) a(district)
		local n_dd_`x' = string(`e(N)',"%9.0fc")
		local b_dd_`x' = string(_b[t_16],"%9.3fc")
		local se_dd_`x' =string(_se[t_16],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[t_16]/_se[t_16])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local b_dd_`x' `b_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local b_dd_`x' `b_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local b_dd_`x' `b_dd_`x''***
		}
		
		local csb_dd_`x' = string(_b[_cons],"%9.3fc")
		local csse_dd_`x' =string(_se[_cons],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local csb_dd_`x' `csb_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local csb_dd_`x' `csb_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local csb_dd_`x' `csb_dd_`x''***
		}
		
		}
		
	eststo clear
	
	foreach x in `indices_hc' {
		areg `x' t_16 y16 `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		local n_dd_`x' = string(`e(N)',"%9.0fc")
		local b_dd_`x' = string(_b[t_16],"%9.3fc")
		local se_dd_`x' =string(_se[t_16],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[t_16]/_se[t_16])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local b_dd_`x' `b_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local b_dd_`x' `b_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local b_dd_`x' `b_dd_`x''***
		}
		
		local csb_dd_`x' = string(_b[_cons],"%9.3fc")
		local csse_dd_`x' =string(_se[_cons],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local csb_dd_`x' `csb_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local csb_dd_`x' `csb_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local csb_dd_`x' `csb_dd_`x''***
		}
		
		}
	
	**************
	* Individual *
	**************
	
	* Health outcome
	
	* We load the dataset. This is the light version
	
	use "${usedata}/healthoutcome_endline_ind.dta", clear
	
	* In this part, we regress the outcomes over the full treatment vs control
	
	local var treatfull
	
	local x healthoutcome_z
	
	* At endline:
	
	**************
	* No control *
	**************
	
	eststo clear

		areg  e_`x' `var' b_`x', robust cl(hc_id) a(district)
		local n_nocon_`x' = string(`e(N)',"%9.0fc")
		local b_nocon_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocon_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocon_`x' =string(_se[_cons],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local csb_nocon_`x' `csb_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local csb_nocon_`x' `csb_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local csb_nocon_`x' `csb_nocon_`x''***
		}
		
	
	*********
	* No FE *
	*********
	
	* We define the control variable
	
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	foreach x in e_ {
	
		local `x'controls_tfull
		
		}
		
	foreach x in e_ {
		foreach var in treatfull {
			local `var'_int_`x'controls
						}
		}
		
	foreach var of local e_controls_noprefix {
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
			}	
				
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
				}
		}
	
	
	local var treatfull
	
	local x healthoutcome_z
	
	eststo clear
	
		reg  e_`x' `var' b_`x' `e_controls_tfull' ``var'_int_e_controls', cl(hc_id) robust
		local n_nofe_`x' = string(`e(N)',"%9.0fc")
		local b_nofe_`x' = string(_b[treatfull],"%9.3fc")
		local se_nofe_`x' =string(_se[treatfull],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = string(_b[_cons],"%9.3fc")
		local csse_nofe_`x' =string(_se[_cons],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local csb_nofe_`x' `csb_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local csb_nofe_`x' `csb_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local csb_nofe_`x' `csb_nofe_`x''***
		}
		
	*****************************************
	**ADDED LATER: NO COV*TREAT INTERACTION**
	*****************************************

	
	* We define the control variable
	
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	foreach x in e_ {
	
		local `x'controls_tfull
		
		}
		
	foreach x in e_ {
		foreach var in treatfull {
			local `var'_int_`x'controls
						}
		}
		
	foreach var of local e_controls_noprefix {
		local e_controls_tfull `e_controls_tfull' c_tfull_`var'
			}	
				
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
				}
		}
	
	
	local var treatfull
	
	local x healthoutcome_z
	
	eststo clear
	
	areg  e_`x' `var' b_`x' `e_controls_tfull' ``var'_int_e_controls', cl(hc_id) robust a(district)
		local n_noint_`x' = string(`e(N)',"%9.0fc")
		local b_noint_`x' = string(_b[treatfull],"%9.3fc")
		local se_noint_`x' =string(_se[treatfull],"%9.3fc")
		local p_noint_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_noint_`x'' <= 0.1 & `p_noint_`x'' > 0.05{
			local b_noint_`x' `b_noint_`x''*
		}
	
		if `p_noint_`x'' <= 0.05 & `p_noint_`x'' > 0.01{
			local b_noint_`x' `b_noint_`x''**
		}
		
		if `p_noint_`x'' <= 0.01 & `p_noint_`x'' > 0 {
			local b_noint_`x' `b_noint_`x''***
		}
		
		local csb_noint_`x' = string(_b[_cons],"%9.3fc")
		local csse_noint_`x' =string(_se[_cons],"%9.3fc")
		local p_noint_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_noint_`x'' <= 0.1 & `p_noint_`x'' > 0.05{
			local csb_noint_`x' `csb_noint_`x''*
		}
	
		if `p_noint_`x'' <= 0.05 & `p_noint_`x'' > 0.01{
			local csb_noint_`x' `csb_noint_`x''**
		}
		
		if `p_noint_`x'' <= 0.01 & `p_noint_`x'' > 0 {
			local csb_noint_`x' `csb_noint_`x''***
		}
	
	*************************
	* Agregated at HC level *
	*************************
	
	preserve
	
	** Our first step is to create the mean at HC level
	
	byso hc_id : egen tmean_e_`x' = mean(e_`x') 
	byso hc_id : egen mean_e_`x' = max(tmean_e_`x')
	
	byso hc_id : egen tmean_b_`x' = mean(b_`x')
	byso hc_id : egen mean_b_`x' = max(tmean_b_`x')
	
	drop tmean_*
	
	* We need to do the same at hc level
	
	local controls hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
	
	* We create unique hh as we are at child level
	
	byso hh_id: gen count = _n
	
	* We will remove the mean from the control variable
	
	* Full treatment ( we don't need to create a endline presence as we already have a sample with only household present)

	foreach var of local controls {
		byso hc_id: egen temp_mean_`var' = mean(`var') if treatfull != . & count == 1
		byso hc_id: egen t_mean_`var' = max(temp_mean_`var') if treatfull != .
		qui sum t_mean_`var' if treatfull != . & uniquehc == 1
		gen c_tfull_hc_`var' = t_mean_`var' - `r(mean)'
		lab var c_tfull_hc_`var' "Control variable of `var' minus its mean in the full treatment at hc level"
		drop t_mean_`var' temp_mean_`var'
		}
		
	drop count
	
	* Full treatment
	
	foreach x of local controls {
			gen c_treatfull_hc_`x' = treatfull * c_tfull_hc_`x'
			lab var c_treatfull_hc_`x' "Interaction term of contral variable `x' with treatment at hc level"
			}
	
	* We take care of duplicates 
	
	duplicates drop hh_id uniquehc, force
	
	drop uniquehc 
	
	egen uniquehc = tag(hc_id) if endline_presence == 1
	recode uniquehc(.=0)
	lab var uniquehc "Unique HC"
	
	* We local the variable
	
	foreach x in e_ {
	
		local `x'controls_tfull_hc
		
		}
		
	foreach x in e_ {
		foreach var in treatfull {
			local `var'_hc_int_`x'controls
			}
		}
		
	foreach var of local e_controls_noprefix {
		local e_controls_tfull_hc `e_controls_tfull_hc' c_tfull_hc_`var'
		}	
				
	foreach treat in treatfull {
		foreach var of local e_controls_noprefix {
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			}
		}
	
	
	local var treatfull
	
	local x healthoutcome_z
	
	eststo clear
	
		areg  mean_e_`x' `var' mean_b_`x' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		local n_mean_`x' = string(`e(N)',"%9.0fc")
		local b_mean_`x' = string(_b[treatfull],"%9.3fc")
		local se_mean_`x' =string(_se[treatfull],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local b_mean_`x' `b_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local b_mean_`x' `b_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local b_mean_`x' `b_mean_`x''***
		}
		
		local csb_mean_`x' = string(_b[_cons],"%9.3fc")
		local csse_mean_`x' =string(_se[_cons],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local csb_mean_`x' `csb_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local csb_mean_`x' `csb_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local csb_mean_`x' `csb_mean_`x''***
		}
		
	restore
	
	***********************************
	* Diff in Diff endline - baseline *
	***********************************

	local var treatfull
	
	local x healthoutcome_z
	
	keep hh_id hc_id e_healthoutcome_z b_healthoutcome_z `e_controls_tfull' ``var'_int_e_controls'  district uniquehc treatfull endline_presence
	
	gen nomeasure_endline = (b_healthoutcome_z == . | e_healthoutcome_z == .)
	replace nomeasure_endline = 1 if endline_presence == 0
	
	ren b_`x' `x'_b
	ren e_`x' `x'_e
	
	* Creating a new id to reshape
	
	byso hh_id: gen temp = _n
	
	tostring hh_id temp, replace
	
	replace hh_id = hh_id + temp
	
	destring hh_id, replace
	
	drop temp
	
	* Reshape
	
	reshape long healthoutcome_z , i(hh_id) j(num) s
	
	gen y16 = (num == "_e")
	
	drop num
	
	gen t_16 = treatfull*y16
	
		areg `x' t_16 y16 `e_controls_tfull' ``var'_int_e_controls' if endline_presence == 1, robust cl(hc_id) a(district)
		local n_dd_`x' = string(`e(N)',"%9.0fc")
		local b_dd_`x' = string(_b[t_16],"%9.3fc")
		local se_dd_`x' =string(_se[t_16],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[t_16]/_se[t_16])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local b_dd_`x' `b_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local b_dd_`x' `b_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local b_dd_`x' `b_dd_`x''***
		}
		
		local csb_dd_`x' = string(_b[_cons],"%9.3fc")
		local csse_dd_`x' =string(_se[_cons],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local csb_dd_`x' `csb_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local csb_dd_`x' `csb_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local csb_dd_`x' `csb_dd_`x''***
		}
	
	* Child mortality
	
	* We load the dataset. This is the light version
	
	use "${usedata}/mortality_endline_ind.dta", clear
	
	* In this part, we regress the outcomes over the full treatment vs control
	
	local var treatfull
	
	local x mortrate_z
	
	local controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
	
	foreach bracket in 05 {
		local controls_tfull`bracket'
		}

	foreach bracket in 05 {
		foreach var in treatfull {
			local `var'_`bracket'_controls
			}
		}
		
	foreach bracket in 05 {
		foreach var of local controls_noprefix {
			local controls_tfull`bracket' `controls_tfull`bracket'' c_tfull`bracket'_`var'
			}
		}
	
	foreach bracket in 05 {
		foreach treat in treatfull {
			foreach var of local controls_noprefix {
				local `treat'_`bracket'_controls ``treat'_`bracket'_controls' c_`treat'`bracket'_`var'
				}
			}
		}
		
	* At endline:
	
	**************
	* No control *
	**************
	
	eststo clear

		stset e_survmonths_ab_05, failure(dead_endline==1) id(childroster_id)
		stcox treatfull b_mortrate_05 e_birthmonth  if e_agebracket_05 == 1, vce(cluster hc_id)
		
		local n_nocon_`x' = string(`e(N)',"%9.0fc")
		local b_nocon_`x' = string(exp(_b[treatfull]),"%9.3fc")
		
		local se_nocon_`x' exp(_b[treatfull])*_se[treatfull]
		local se_nocon_`x' = string(`se_nocon_`x'',"%9.3fc")
		
		local p_nocon_`x' = 0.811
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = "n/a"
		local csse_nocon_`x' = "n/a"
	
	*********
	* No FE *
	*********
	
	eststo clear
	
		stset e_survmonths_ab_05, failure(dead_endline==1) id(childroster_id)
		stcox treatfull `controls_tfull05' `treatfull_05_controls' b_mortrate_05 e_birthmonth if e_agebracket_05 == 1, vce(cluster hc_id)
		
		local n_nofe_`x' = string(`e(N)',"%9.0fc")
		local b_nofe_`x' = string(exp(_b[treatfull]),"%9.3fc")
		local se_nofe_`x' exp(_b[treatfull])*_se[treatfull]
		local se_nofe_`x' = string(`se_nofe_`x'',"%9.3fc")
		
		local p_nofe_`x' = 0.799
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = "n/a"
		local csse_nofe_`x' = "n/a"
		
	* We outsheet the version including child mortality hc 
	
	texdoc init "${tables}/TableI34.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \small
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Robustness checks -- Main outcomes with no HC subcomponents treatment quality}
	tex \begin{tabular}{lggggggg}
	tex \toprule
	tex 											  & (1)                       & (2)                                                          & (3)                                                             & (4)                                                        & (5) & (6) & (7)                        \\
    tex                              & \textbf{\begin{tabular}[c]{@{}c@{}}Citizen \\ monitoring\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Perceived \\ citizen \\ pressure\end{tabular}} & \textbf{Utilization}      & \textbf{\begin{tabular}[c]{@{}c@{}}Treatment \\ quality\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Patient \\ satisfaction\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Health \\ outcomes\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Child \\ mortality\end{tabular}}        \\
	tex \midrule
	tex \textit{A: Without control variables} \\
	tex \multirow{2}{*}{Program impact}   &`b_nocon_commtg_z' &`b_nocon_h_ctzpressure_z' &`b_nocon_urate_z'           & `b_nocon_treatqualalt_z'                                                            & `b_nocon_patsat_z'                                                               & `b_nocon_healthoutcome_z'                                                          & `b_nocon_mortrate_05'         \\
	tex  & (`se_nocon_commtg_z') & (`se_nocon_h_ctzpressure_z') & (`se_nocon_urate_z')           & (`se_nocon_treatqualalt_z')                                                            & (`se_nocon_patsat_z')                                                               & (`se_nocon_healthoutcome_z')                                                          & (`se_nocon_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}   &`csb_nocon_commtg_z' &`csb_nocon_h_ctzpressure_z' &`csb_nocon_urate_z'           & `csb_nocon_treatqualalt_z'                                                            & `csb_nocon_patsat_z'                                                               & `csb_nocon_healthoutcome_z'                                                          & `csb_nocon_mortrate_05'         \\
	tex  & (`csse_nocon_commtg_z') & (`csse_nocon_h_ctzpressure_z') & (`csse_nocon_urate_z')           & (`csse_nocon_treatqualalt_z')                                                            & (`csse_nocon_patsat_z')                                                               & (`csse_nocon_healthoutcome_z')                                                          & `csse_nocon_mortrate_05'         \\
	tex \\
	tex \textit{B: Without district fixed effects} \\
	tex \multirow{2}{*}{Program impact}   &`b_nofe_commtg_z' &`b_nofe_h_ctzpressure_z' &`b_nofe_urate_z'           & `b_nofe_treatqualalt_z'                                                            & `b_nofe_patsat_z'                                                               & `b_nofe_healthoutcome_z'                                                          & `b_nofe_mortrate_05'         \\
	tex  & (`se_nofe_commtg_z') & (`se_nofe_h_ctzpressure_z') & (`se_nofe_urate_z')           & (`se_nofe_treatqualalt_z')                                                            & (`se_nofe_patsat_z')                                                               & (`se_nofe_healthoutcome_z')                                                          & (`se_nofe_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}   & `csb_nofe_commtg_z' & `csb_nofe_h_ctzpressure_z' & `csb_nofe_urate_z'           & `csb_nofe_treatqualalt_z'                                                            & `csb_nofe_patsat_z'                                                               & `csb_nofe_healthoutcome_z'                                                          & `csb_nofe_mortrate_05'         \\
	tex  & (`csse_nofe_commtg_z') & (`csse_nofe_h_ctzpressure_z') & (`csse_nofe_urate_z')           & (`csse_nofe_treatqualalt_z')                                                            & (`csse_nofe_patsat_z')                                                               & (`csse_nofe_healthoutcome_z')                                                          & `csse_nofe_mortrate_05'         \\
	tex \\ 
	tex \textit{C: With outcome measures aggregated at HC level} \\
	tex \multirow{2}{*}{Program impact}   & `b_mean_commtg_z'  & `b_mean_h_ctzpressure_z' & `b_mean_urate_z'           & `b_mean_treatqualalt_z'                                                            & `b_mean_patsat_z'                                                               & `b_mean_healthoutcome_z'                                                          & `b_mean_mortrate_05'         \\
	tex  & (`se_mean_commtg_z')  & (`se_mean_h_ctzpressure_z') & (`se_mean_urate_z')           & (`se_mean_treatqualalt_z')                                                            & (`se_mean_patsat_z')                                                               & (`se_mean_healthoutcome_z')                                                          & (`se_mean_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}   & `csb_mean_commtg_z' & `csb_mean_h_ctzpressure_z' & `csb_mean_urate_z'           & `csb_mean_treatqualalt_z'                                                            & `csb_mean_patsat_z'                                                               & `csb_mean_healthoutcome_z'                                                          & `csb_mean_mortrate_05'         \\
	tex  & (`csse_mean_commtg_z') & (`csse_mean_h_ctzpressure_z') & (`csse_mean_urate_z')           & (`csse_mean_treatqualalt_z')                                                            & (`csse_mean_patsat_z')                                                               & (`csse_mean_healthoutcome_z')                                                          & (`csse_mean_mortrate_05')         \\
	tex \\ 
	tex \textit{D: Difference between post and pre-treatment values} \\
	tex \multirow{2}{*}{Program impact}   & `b_dd_commtg_z'  & `b_dd_h_ctzpressure_z' & `b_dd_urate_z'           & `b_dd_treatqualalt_z'                                                            & `b_dd_patsat_z'                                                               & `b_dd_healthoutcome_z'                                                          & `b_dd_mortrate_05'         \\
	tex  & (`se_dd_commtg_z')  & (`se_dd_h_ctzpressure_z')  & (`se_dd_urate_z')           & (`se_dd_treatqualalt_z')                                                            & (`se_dd_patsat_z')                                                               & (`se_dd_healthoutcome_z')                                                          & (`se_dd_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}  & `csb_dd_commtg_z' & `csb_dd_h_ctzpressure_z' & `csb_dd_urate_z'           & `csb_dd_treatqualalt_z'                                                            & `csb_dd_patsat_z'                                                               & `csb_dd_healthoutcome_z'                                                          & `csb_dd_mortrate_05'         \\
	tex & (`csse_dd_commtg_z') & (`csse_dd_h_ctzpressure_z') & (`csse_dd_urate_z')           & (`csse_dd_treatqualalt_z')                                                            & (`csse_dd_patsat_z')                                                               & (`csse_dd_healthoutcome_z')                                                          & (`csse_dd_mortrate_05')         \\
	tex \midrule
	tex Observations (A \& B)  & `n_nocon_commtg_z' & `n_nocon_h_ctzpressure_z' & `n_nocon_urate_z'           & `n_nocon_treatqualalt_z'                                                            & `n_nocon_patsat_z'                                                               & `n_nocon_healthoutcome_z'                                                          & `n_nocon_mortrate_05'         \\
	tex Observations (C) & `n_mean_commtg_z' & `n_mean_h_ctzpressure_z' & `n_mean_urate_z'           & `n_mean_treatqualalt_z'                                                            & `n_mean_patsat_z'                                                               & `n_mean_healthoutcome_z'                                                          & `n_mean_mortrate_05'         \\
	tex Observations (D) & `n_dd_commtg_z' & `n_dd_h_ctzpressure_z' & `n_dd_urate_z'           & `n_dd_treatqualalt_z'                                                            & `n_dd_patsat_z'                                                               & `n_dd_healthoutcome_z'                                                          & `n_dd_mortrate_05'         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	********************************************************
	* Table I35: Main outcomes and presence of an official *
	********************************************************
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* Main outcomes
	
	local indices urate_z treatqual_z patsat_z commtg_z
	local indices_ho healthout_z
	local indices_hc mortrate_05 h_ctzpressure_z
	
	* Main outcomes in details
	
	local utilization urate_z visit_hf_z hf_otherpract_z 
	local utilization_vacc immunization_z
	
	local treatmentqual treatqual_z use_equip_z tot_wait_z trained_z exam_privacy_z taketest_z diagnosis_explained_z 
	local treatmentqual_hclevel h_percentstaff_sv_z h_cleanliness_z h_meanstock_z

	local patsat patsat_z qualitycare_z politestaff_z interest_health_z stafflistening_z freeexpress_z yearb_avail_z
	local patsat_nobaseline qualityhc_d_z
	
	local healthoutcomes_ho healthout_z 
	local healthoutcomes_ho18m weight_18m_z muac_18m_z
	local healthoutcomes_ho36m weight_36m_z muac_36m_z
	
	local childmortality mortrate_05 mortrate_01 mortrate_15 
	
	* Intermediate outcomes
	
	local intermediate ctzknow_z eff_z commresp_z relhhhc_z
	local intermediate_hclevel h_hcpknow_z h_hctrans_z
	
	* Prior to the analysis as a sanity check we try to understand the implication of timing with sc attendance
	
	* We need to merge subcounty_id
	
	merge m:1 hc_id using "${usedata}/subcounty_id.dta", nogen
	
	merge m:1 hc_id using "${usedata}/sc_offical_attendance.dta", nogen
	
	* We rank the date of intervention
	
	byso sc_id : egen rank_inter = rank(bm_h_treatinfo_dateimplmt) if uniquehc == 1 & treatfull == 1, unique
	lab def rank 1 "First implementation" 2 "Second implementation" 3 "Third implementation"
	lab val rank_inter rank
	
	******************
	* Full treatment *
	******************
	
	* Full treatment implies we will use control full treatment demeaned.
	
	local var treatfull
	
	eststo clear
	
	****************
	* Main indices *
	****************

	* At endline:

	eststo clear
	
	* We regress our main indices
	
	foreach x in `indices' {
		areg  e_`x' `var' b_`x' b_`x'_d sc_attend `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
	
		local n_1_`x' = `e(N)'
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[`var'],"%9.3fc")
		local se_1_`x' = string(_se[`var'],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[sc_attend],"%9.3fc")
		local se_2_`x' = string(_se[sc_attend],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[sc_attend]/_se[sc_attend])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local est_3_`x' = string(_b[_cons],"%9.3fc")
		local se_3_`x' = string(_se[_cons],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''***"
				}
	
		lincom treatfull + sc_attend
		local est_4_`x' = string(`r(estimate)',"%9.3fc")
		local se_4_`x' = string(`r(se)',"%9.3fc")
		local se_4_`x' = "(`se_4_`x'')"
		test treatfull + sc_attend = 0
		local p_4_`x' = `r(p)'
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
		
		drop s_*
		}
		
		
	foreach x in `indices_ho' {
		areg  e_`x' `var' b_`x' b_`x'_d sc_attend `e_controls_tfull_hoe' `tfulli_hoe_e_controls', robust cl(hc_id) a(district)
		
		local n_1_`x' = `e(N)'
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[`var'],"%9.3fc")
		local se_1_`x' = string(_se[`var'],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[sc_attend],"%9.3fc")
		local se_2_`x' = string(_se[sc_attend],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[sc_attend]/_se[sc_attend])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local est_3_`x' = string(_b[_cons],"%9.3fc")
		local se_3_`x' = string(_se[_cons],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''***"
				}
	
		lincom treatfull + sc_attend
		local est_4_`x' = string(`r(estimate)',"%9.3fc")
		local se_4_`x' = string(`r(se)',"%9.3fc")
		local se_4_`x' = "(`se_4_`x'')"
		test treatfull + sc_attend = 0
		local p_4_`x' = `r(p)'
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
		
		drop s_*
		}
	
	foreach x in `indices_hc' {
		areg  e_`x' `var' b_`x' sc_attend `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)

		local n_1_`x' = `e(N)'
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[`var'],"%9.3fc")
		local se_1_`x' = string(_se[`var'],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[sc_attend],"%9.3fc")
		local se_2_`x' = string(_se[sc_attend],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[sc_attend]/_se[sc_attend])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local est_3_`x' = string(_b[_cons],"%9.3fc")
		local se_3_`x' = string(_se[_cons],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''***"
				}
	
		lincom treatfull + sc_attend
		local est_4_`x' = string(`r(estimate)',"%9.3fc")
		local se_4_`x' = string(`r(se)',"%9.3fc")
		test treatfull + sc_attend = 0
		local p_4_`x' = `r(p)'
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
		
		drop s_*
		}
		
	* We create the tables concerning the results of the main indices
	
	texdoc init "${tables}/TableI35.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \footnotesize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Main outcomes: Averaged z-score indices}
	tex \begin{tabular}{lgggggggg}
	tex \toprule
	tex 											  & (1)                       & (2)                                                          & (3)                                                             & (4)                                                        & (5) & (6) & (7)                       \\
    tex \multirow{-2}{*}{}                      & \textbf{\begin{tabular}[c]{@{}c@{}}Citizen \\ monitoring\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Perceived \\ citizen \\ pressure\end{tabular}}         & \textbf{Utilization}      & \textbf{\begin{tabular}[c]{@{}c@{}}Treatment \\ quality\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Patient \\ satisfaction\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Health \\ outcomes\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Child \\ mortality\end{tabular}}        \\
	tex \midrule
	tex \multirow{2}{*}{Full treatment}  & `est_1_commtg_z' & `est_1_h_ctzpressure_z' & `est_1_urate_z'           & `est_1_treatqual_z'                                                            & `est_1_patsat_z'                                                               & `est_1_healthout_z'                                                          & `est_1_mortrate_05'         \\
	tex  & (`se_1_commtg_z') & (`se_1_h_ctzpressure_z') & (`se_1_urate_z')           & (`se_1_treatqual_z')                                                            & (`se_1_patsat_z')                                                               & (`se_1_healthout_z')                                                          & (`se_1_mortrate_05')         \\
	tex \multirow{2}{*}{Subcounty official attendance}  & `est_2_commtg_z' & `est_2_h_ctzpressure_z' & `est_2_urate_z'           & `est_2_treatqual_z'                                                            & `est_2_patsat_z'                                                               & `est_2_healthout_z'                                                          & `est_2_mortrate_05'         \\
	tex  & (`se_2_commtg_z') & (`se_2_h_ctzpressure_z') & (`se_2_urate_z')           & (`se_2_treatqual_z')                                                            & (`se_2_patsat_z')                                                               & (`se_2_healthout_z')                                                          & (`se_2_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}  & `est_3_commtg_z' & `est_3_h_ctzpressure_z' & `est_3_urate_z'           & `est_3_treatqual_z'                                                            & `est_3_patsat_z'                                                               & `est_3_healthout_z'                                                          & `est_3_mortrate_05'         \\
	tex  & (`se_3_commtg_z') & (`se_3_h_ctzpressure_z')& (`se_3_urate_z')           & (`se_3_treatqual_z')                                                            & (`se_3_patsat_z')                                                               & (`se_3_healthout_z')                                                          & (`se_3_mortrate_05')         \\
	tex \midrule
	tex \multirow{1}{*}{N} & `n_1_commtg_z' & `n_1_h_ctzpressure_z' & `n_1_urate_z'           & `n_1_treatqual_z'                                                            & `n_1_patsat_z'                                                             & `n_1_healthout_z'                                                          & `n_1_mortrate_05'         \\
	tex \multirow{1}{*}{R$^{2}$}   & `r2_1_commtg_z'  & `r2_1_h_ctzpressure_z'  & `r2_1_urate_z'           & `r2_1_treatqual_z'                                                           & `r2_1_patsat_z'                                                               & `r2_1_healthout_z'                                                         & `r2_1_mortrate_05'         \\
	tex \multirow{2}{*}{Full treatment net effect}   & `est_4_commtg_z'  & `est_4_h_ctzpressure_z'  & `est_4_urate_z'           & `est_4_treatqual_z'                                                            & `est_4_patsat_z'                                                              & `est_4_healthout_z'                                                          & `est_4_mortrate_05'         \\
	tex & (`se_4_commtg_z') & (`se_4_h_ctzpressure_z') & (`se_4_urate_z')           & (`se_4_treatqual_z')                                                            & (`se_4_patsat_z')                                                              & (`se_4_healthout_z')                                                          & (`se_4_mortrate_05')         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	***************************************************************************************
	* Table I36: Subcomponents of the treatment quality index and presence of an official *
	***************************************************************************************
	
	* At endline:
	
	eststo clear
	
	foreach x in `treatmentqual' {
		areg  e_`x' `var' b_`x' b_`x'_d sc_attend `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
		
		local n_1_`x' = `e(N)'
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[`var'],"%9.3fc")
		local se_1_`x' = string(_se[`var'],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[sc_attend],"%9.3fc")
		local se_2_`x' = string(_se[sc_attend],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[sc_attend]/_se[sc_attend])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local est_3_`x' = string(_b[_cons],"%9.3fc")
		local se_3_`x' = string(_se[_cons],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''***"
				}
	
		lincom treatfull + sc_attend
		local est_4_`x' = string(`r(estimate)',"%9.3fc")
		local se_4_`x' = string(`r(se)',"%9.3fc")
		local se_4_`x' = "(`se_4_`x'')"
		test treatfull + sc_attend = 0
		local p_4_`x' = `r(p)'
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
		
		drop s_*
		}
		
		
	foreach x in `treatmentqual_hclevel' {
		areg  e_`x' `var' b_`x' b_`x'_d sc_attend `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)

		local n_1_`x' = `e(N)'
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[`var'],"%9.3fc")
		local se_1_`x' = string(_se[`var'],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[sc_attend],"%9.3fc")
		local se_2_`x' = string(_se[sc_attend],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[sc_attend]/_se[sc_attend])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local est_3_`x' = string(_b[_cons],"%9.3fc")
		local se_3_`x' = string(_se[_cons],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''***"
				}
	
		lincom treatfull + sc_attend
		local est_4_`x' = string(`r(estimate)',"%9.3fc")
		local se_4_`x' = string(`r(se)',"%9.3fc")
		local se_4_`x' = "(`se_4_`x'')"
		test treatfull + sc_attend = 0
		local p_4_`x' = `r(p)'
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
		
		drop s_*
		}
	
	* We create the tables concerning the results of the treatment quality index
	
	texdoc init "${tables}/TableI36.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \footnotesize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Treatment quality index: subcomponents}
	tex \begin{tabular}{lgggggggggg}
	tex \toprule
	tex 											  & (1)                       & (2)                                                          & (3)                                                             & (4)           & (5) & (6) & (7) & (8) & (9) & (10)                                                                   \\
    tex \multirow{-2}{*}{}                               & \textbf{\begin{tabular}[c]{@{}c@{}}Treatment\\quality\\index\end{tabular}}      & \begin{tabular}[c]{@{}c@{}}Used\\equipment\end{tabular} & \begin{tabular}[c]{@{}c@{}}Waiting\\time\end{tabular} & \begin{tabular}[c]{@{}c@{}}Examined\\by trained\\staff\end{tabular} & \begin{tabular}[c]{@{}c@{}}Privacy\\during\\exam\end{tabular} & \begin{tabular}[c]{@{}c@{}}Received\\test when\\needed\end{tabular} & \begin{tabular}[c]{@{}c@{}}Diagnosis\\explained\\clearly\end{tabular} & \begin{tabular}[c]{@{}c@{}}\% staff\\presence\end{tabular} & \begin{tabular}[c]{@{}c@{}}Facility\\cleanliness\end{tabular} & \begin{tabular}[c]{@{}c@{}}Drug\\availability\end{tabular} \\
	tex \midrule
	tex \multirow{2}{*}{Full treatment}  & `est_1_treatqual_z'           & `est_1_use_equip_z'                                                            & `est_1_tot_wait_z'                                                               & `est_1_trained_z'      & `est_1_exam_privacy_z'     & `est_1_taketest_z'   & `est_1_diagnosis_explained_z'    & `est_1_h_percentstaff_sv_z'      &     `est_1_h_cleanliness_z'  & `est_1_h_meanstock_z'                           \\
	tex  & (`se_1_treatqual_z')           & (`se_1_use_equip_z')                                                            & (`se_1_tot_wait_z')                                                               & (`se_1_trained_z')                & (`se_1_exam_privacy_z')     & (`se_1_taketest_z')   & (`se_1_diagnosis_explained_z')    & (`se_1_h_percentstaff_sv_z')      &    (`se_1_h_cleanliness_z')  & (`se_1_h_meanstock_z')  \\
	tex \multirow{2}{*}{Subcounty official presence}  & `est_2_treatqual_z'           & `est_2_use_equip_z'                                                            & `est_2_tot_wait_z'                                                               & `est_2_trained_z'          & `est_2_exam_privacy_z'     & `est_2_taketest_z'   & `est_2_diagnosis_explained_z'    & `est_2_h_percentstaff_sv_z'      &     `est_2_h_cleanliness_z'  & `est_2_h_meanstock_z'                                                       \\
	tex  & (`se_2_treatqual_z')           & (`se_2_use_equip_z')                                                            & (`se_2_tot_wait_z')                                                               & (`se_2_trained_z')           & (`se_2_exam_privacy_z')     & (`se_2_taketest_z')   & (`se_2_diagnosis_explained_z')    & (`se_2_h_percentstaff_sv_z')      &     (`se_2_h_cleanliness_z')  & (`se_2_h_meanstock_z')                                                       \\
	tex \multirow{2}{*}{Constant}  & `est_3_treatqual_z'           & `est_3_use_equip_z'                                                            & `est_3_tot_wait_z'                                                               & `est_3_trained_z'       & `est_3_exam_privacy_z'     & `est_3_taketest_z'   & `est_3_diagnosis_explained_z'    & `est_3_h_percentstaff_sv_z'      &     `est_3_h_cleanliness_z'  & `est_3_h_meanstock_z'                                                           \\
	tex  & (`se_3_treatqual_z')           & (`se_3_use_equip_z')                                                            & (`se_3_tot_wait_z')                                                               & (`se_3_trained_z')                    & (`se_3_exam_privacy_z')     & (`se_3_taketest_z')   & (`se_3_diagnosis_explained_z')    & (`se_3_h_percentstaff_sv_z')      &     (`se_3_h_cleanliness_z')  & (`se_3_h_meanstock_z')                                              \\
	tex \midrule
	tex \multirow{1}{*}{N} & `n_1_treatqual_z'           & `n_1_use_equip_z'                                                            & `n_1_tot_wait_z'                                                             & `n_1_trained_z'         & `n_1_exam_privacy_z'     & `n_1_taketest_z'   & `n_1_diagnosis_explained_z'    & `n_1_h_percentstaff_sv_z'      &     `n_1_h_cleanliness_z'  & `n_1_h_meanstock_z'                                                         \\
	tex \multirow{1}{*}{R$^{2}$}   & `r2_1_treatqual_z'           & `r2_1_use_equip_z'                                                           & `r2_1_tot_wait_z'                                                               & `r2_1_trained_z'                   & `r2_1_exam_privacy_z'     & `r2_1_taketest_z'   & `r2_1_diagnosis_explained_z'    & `r2_1_h_percentstaff_sv_z'      &     `r2_1_h_cleanliness_z'  & `r2_1_h_meanstock_z'                                             \\
	tex \multirow{2}{*}{Full treatment net effect}  & `est_4_treatqual_z'           & `est_4_use_equip_z'                                                            & `est_4_tot_wait_z'                                                               & `est_4_trained_z'            & `est_4_exam_privacy_z'     & `est_4_taketest_z'   & `est_4_diagnosis_explained_z'    & `est_4_h_percentstaff_sv_z'      &     `est_4_h_cleanliness_z'  & `est_4_h_meanstock_z'                                                     \\
	tex  & (`se_4_treatqual_z')           & (`se_4_use_equip_z')                                                            & (`se_4_tot_wait_z')                                                               & (`se_4_trained_z')                                                               & (`se_4_exam_privacy_z')     & (`se_4_taketest_z')   & (`se_4_diagnosis_explained_z')    & (`se_4_h_percentstaff_sv_z')      &     (`se_4_h_cleanliness_z')  & (`se_4_h_meanstock_z')  \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	********************************************************************************
	* Table I37: Subcomponents of patient satisfaction and presence of an official *
	********************************************************************************

	* At endline:
	
	eststo clear
	
	foreach x in `patsat' {
		areg  e_`x' `var' b_`x' b_`x'_d sc_attend `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)

		local n_1_`x' = `e(N)'
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[`var'],"%9.3fc")
		local se_1_`x' = string(_se[`var'],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[sc_attend],"%9.3fc")
		local se_2_`x' = string(_se[sc_attend],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[sc_attend]/_se[sc_attend])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local est_3_`x' = string(_b[_cons],"%9.3fc")
		local se_3_`x' = string(_se[_cons],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''***"
				}
	
		lincom treatfull + sc_attend
		local est_4_`x' = string(`r(estimate)',"%9.3fc")
		local se_4_`x' = string(`r(se)',"%9.3fc")
		local se_4_`x' = "(`se_4_`x'')"
		test treatfull + sc_attend = 0
		local p_4_`x' = `r(p)'
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
		
		drop s_*
		}
		
	
	foreach x in `patsat_nobaseline' {
		areg  e_`x' `var' sc_attend `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)

		local n_1_`x' = `e(N)'
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[`var'],"%9.3fc")
		local se_1_`x' = string(_se[`var'],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[sc_attend],"%9.3fc")
		local se_2_`x' = string(_se[sc_attend],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[sc_attend]/_se[sc_attend])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local est_3_`x' = string(_b[_cons],"%9.3fc")
		local se_3_`x' = string(_se[_cons],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local est_3_`x' = "`est_3_`x''***"
				}
	
		lincom treatfull + sc_attend
		local est_4_`x' = string(`r(estimate)',"%9.3fc")
		local se_4_`x' = string(`r(se)',"%9.3fc")
		local se_4_`x' = "(`se_4_`x'')"
		test treatfull + sc_attend = 0
		local p_4_`x' = `r(p)'
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
		
		drop s_*
		}

	* We create the tables concerning the results of the patient satisfaction index
	
	texdoc init "${tables}/TableI37.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \footnotesize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Patient satisfaction: subcomponents}
	tex \begin{tabular}{lggggggg}
	tex \toprule
	tex 											  & (1)                       & (2)                                                          & (3)                                                             & (4)           & (5) & (6) & (7)                                                                   \\
    tex \multirow{-2}{*}{}                               & \textbf{\begin{tabular}[c]{@{}c@{}}Patient\\satisfaction\\index\end{tabular}}      & \begin{tabular}[c]{@{}c@{}}Satisfied by\\HC quality\end{tabular} & \begin{tabular}[c]{@{}c@{}}Satisfied\\with quality\\of care\end{tabular} & \begin{tabular}[c]{@{}c@{}}Polite\\staff\end{tabular} & \begin{tabular}[c]{@{}c@{}}Staff\\interested\\in health\end{tabular} & \begin{tabular}[c]{@{}c@{}}Free to\\express\\clearly\end{tabular} & \begin{tabular}[c]{@{}c@{}}Availability\\of staff\\improving\end{tabular} \\
	tex \midrule
	tex \multirow{2}{*}{Full treatment}  & `est_1_patsat_z'           & `est_1_qualitycare_z'                                                            & `est_1_politestaff_z'                                                               & `est_1_interest_health_z'      & `est_1_stafflistening_z'     & `est_1_freeexpress_z'   & `est_1_yearb_avail_z'                          \\
	tex  & (`se_1_patsat_z')           & (`se_1_qualitycare_z')                                                            & (`se_1_politestaff_z')                                                               & (`se_1_interest_health_z')                & (`se_1_stafflistening_z')     & (`se_1_freeexpress_z')   & (`se_1_yearb_avail_z')     \\
	tex \multirow{2}{*}{Subcounty official presence}  & `est_2_patsat_z'           & `est_2_qualitycare_z'                                                            & `est_2_politestaff_z'                                                               & `est_2_interest_health_z'          & `est_2_stafflistening_z'     & `est_2_freeexpress_z'   & `est_2_yearb_avail_z'                                                       \\
	tex  & (`se_2_patsat_z')           & (`se_2_qualitycare_z')                                                           & (`se_2_politestaff_z')                                                               & (`se_2_interest_health_z')           & (`se_2_stafflistening_z')     & (`se_2_freeexpress_z')   & (`se_2_yearb_avail_z')                                                       \\
	tex \multirow{2}{*}{Control}  & `est_3_patsat_z'           & `est_3_qualitycare_z'                                                            & `est_3_politestaff_z'                                                               & `est_3_interest_health_z'       & `est_3_stafflistening_z'     & `est_3_freeexpress_z'   & `est_3_yearb_avail_z'                                                           \\
	tex  & (`se_3_patsat_z')           & (`se_3_qualitycare_z')                                                            & (`se_3_politestaff_z')                                                               & (`se_3_interest_health_z')                    & (`se_3_stafflistening_z')     & (`se_3_freeexpress_z')   & (`se_3_yearb_avail_z')                                             \\
	tex \midrule
	tex \multirow{1}{*}{N} & `n_1_patsat_z'           & `n_1_qualitycare_z'                                                            & `n_1_politestaff_z'                                                             & `n_1_interest_health_z'         & `n_1_stafflistening_z'     & `n_1_freeexpress_z'   & `n_1_yearb_avail_z'                                                            \\
	tex \multirow{1}{*}{R$^{2}$}   & `r2_1_patsat_z'           & `r2_1_qualitycare_z'                                                           & `r2_1_politestaff_z'                                                               & `r2_1_interest_health_z'                   & `r2_1_stafflistening_z'     & `r2_1_freeexpress_z'   & `r2_1_yearb_avail_z'                                               \\
	tex \multirow{2}{*}{Full treatment net effect}  & `est_4_patsat_z'           & `est_4_qualitycare_z'                                                            & `est_4_politestaff_z'                                                               & `est_4_interest_health_z'            & `est_4_stafflistening_z'     & `est_4_freeexpress_z'   & `est_4_yearb_avail_z'                                                         \\
	tex  & (`se_4_patsat_z')           & (`se_4_qualitycare_z')                                                            & (`se_4_politestaff_z')                                                               & (`se_4_interest_health_z')                                                               & (`se_4_stafflistening_z')     & (`se_4_freeexpress_z')   & (`se_4_yearb_avail_z')      \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	************************************************************
	* Table I38: Citizen monitoring index – All treatment arms *
	************************************************************
	
	* We work on the coefficient plot for the utilization indice
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `commmonitoring' {
		areg  e_`x' fullomn infomn intomn b_`x' b_`x'_d  `fullomn_int_e_controls' `e_controls' `infomn_int_e_controls' `intomn_int_e_controls', robust cl(hc_id) a(district)

		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(F)
		estadd scalar f_wald3 = r(p)
		
		estimates store m`y'
		
		local y = `y' + 1
		}
		
		
	local y = 4
	
	foreach x in `commmonitoring_nobaseline' {
		areg  e_`x' fullomn infomn intomn `fullomn_int_e_controls' `e_controls' `infomn_int_e_controls' `intomn_int_e_controls', robust cl(hc_id) a(district)
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(F)
		estadd scalar f_wald3 = r(p)
		
		estimates store m`y'
	
		local y = `y' + 1
		}

	# delimit;
	
	esttab m1 m2 m3 m4 m5
	using "${tables}/TableI38.tex", b(%5.3f) se(%5.3f)
		title(Citizen monitoring index -- All treatment arms)
		keep(fullomn infomn intomn _cons)
		varlabels (fullomn "Full treatment" infomn "Information and mobilization only" intomn "Interface only" _cons "Constant")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Citizen\\monitoring\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Attended\\LC1 meetings\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}HC discussed\\at LC1 meetings\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Community\\would find out:\\staff late\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Community\\would find out:\\staff no effort\end{tabular}")
		stats(N r2 f_wald f_wald1 f_wald2 hline f_3 f_wald3, labels("N" "R$^{2}$" "P-value (Information and mobilization = Interface)" "P-value (Information and mobilization = Full treatment)" "P-value (Interface = Full treatment)" "\hline" "F-test (joint significance of all 3 treatment groups)" "P-value (joint significance of all 3 treatment groups)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	********************************************************************
	* Table I39: Perceived citizen pressure index – All treatment arms *
	********************************************************************
	
	* We work on the coefficient plot for the utilization indice
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `ctzpressure_z' {
		areg  e_`x' fullomn infomn intomn b_`x' `fullomn_hc_int_e_controls' `e_controls_hc' `infomn_hc_int_e_controls' `intomn_hc_int_e_controls' if uniquehc == 1 , robust a(district)
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(F)
		estadd scalar f_wald3 = r(p)
		
		estimates store m`y'
		
		local y = `y' + 1
		}
		
	local y = 4
	foreach x in `ctzpressure_nobase' {
		areg  e_`x' fullomn infomn intomn `fullomn_hc_int_e_controls' `e_controls_hc' `infomn_hc_int_e_controls' `intomn_hc_int_e_controls' if uniquehc == 1 , robust a(district)
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(F)
		estadd scalar f_wald3 = r(p)
		
		estimates store m`y'
		
		local y = `y' + 1
		}
		

	# delimit;
	
	esttab m1 m2 m3 m4
	using "${tables}/TableI39.tex", b(%5.3f) se(%5.3f)
		title(Perceived citizen pressure index -- All treatment arms)
		keep(fullomn infomn intomn _cons)
		varlabels (fullomn "Full treatment" infomn "Information and mobilization only" intomn "Interface only" _cons "Constant")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Perceived \\citizen\\pressure\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Community\\ would find out:\\ staff no effort\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Community\\ would find out:\\ staff absent\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Any report\\ of staff\\ wrongdoing\\ in past 12 months\end{tabular}")
		stats(N r2 f_wald f_wald1 f_wald2 hline f_3 f_wald3, labels("N" "R$^{2}$" "P-value (Information and mobilization = Interface)" "P-value (Information and mobilization = Full treatment)" "P-value (Interface = Full treatment)" "\hline" "F-test (joint significance of all 3 treatment groups)" "P-value (joint significance of all 3 treatment groups)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	
	********************************************************
	* Table I40: Utilization outcomes – All treatment arms *
	********************************************************
	
	* We work on the coefficient plot for the utilization indice
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `utilization' {
		areg  e_`x' fullomn infomn intomn b_`x' b_`x'_d  `fullomn_int_e_controls' `e_controls' `infomn_int_e_controls' `intomn_int_e_controls', robust cl(hc_id) a(district)
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(F)
		estadd scalar f_wald3 = r(p)
		
		estimates store m`y'
		
		local y = `y' + 1
		}
		
		
	* Vaccination outcome
	
	local y = 4
	foreach x in `utilization_vacc' {
		areg  e_`x' fullomn infomn intomn b_`x' b_`x'_d  `fullomn_vace_int_e_controls' `e_controls_vace' `infomn_vace_int_e_controls' `intomn_vace_int_e_controls', robust cl(hc_id) a(district)
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(F)
		estadd scalar f_wald3 = r(p)

		estimates store m`y'
		
		}

	# delimit;
	
	esttab m1 m4 m3 m2
	using "${tables}/TableI40.tex", b(%5.3f) se(%5.3f)
		title(Utilization outcomes -- All treatment arms)
		keep(fullomn infomn intomn _cons)
		varlabels (fullomn "Full treatment" infomn "Information and mobilization only" intomn "Interface only" _cons "Constant")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Utilization\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Vaccination rates,\\children\textless 36 months\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}\% of visits to HC,\\vs. other providers\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Number of visits\\ to HC\end{tabular}")
		stats(N r2 f_wald f_wald1 f_wald2 hline f_3 f_wald3, labels("N" "R$^{2}$" "P-value (Information and mobilization = Interface)" "P-value (Information and mobilization = Full treatment)" "P-value (Interface = Full treatment)" "\hline" "F-test (joint significance of all 3 treatment groups)" "P-value (joint significance of all 3 treatment groups)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	**************************************************************
	* Table I41: Treatment quality outcomes – All treatment arms *
	**************************************************************
	
	* We work on the coefficient plot for the utilization indice
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `treatmentqual' {
		areg  e_`x' fullomn infomn intomn b_`x' b_`x'_d `fullomn_int_e_controls' `e_controls' `infomn_int_e_controls' `intomn_int_e_controls', robust cl(hc_id) a(district)
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(F)
		estadd scalar f_wald3 = r(p)
		
		estimates store m`y'
		
		local y = `y' + 1
		}
		
	* HC level outcome
	
	local y = 8
	foreach x in `treatmentqual_hclevel' {
		areg  e_`x' fullomn infomn intomn b_`x' b_`x'_d `fullomn_hc_int_e_controls' `e_controls_hc' `infomn_hc_int_e_controls' `intomn_hc_int_e_controls' if uniquehc == 1 , robust a(district)
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(F)
		estadd scalar f_wald3 = r(p)
		
		estimates store m`y'
		
		local y = `y' + 1
		}
		
	# delimit;
	
	esttab m1 m2 m3 m4 m5 m6 m7 m8 m9 m10
	using "${tables}/TableI41.tex", b(%5.3f) se(%5.3f)
		title(Treatment quality outcomes -- All treatment arms)
		keep(fullomn infomn intomn _cons)
		varlabels (fullomn "Full treatment" infomn "Information and mobilization only" intomn "Interface only" _cons "Constant")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Treatment\\quality\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Used\\equipment\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Waiting\\time\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Examined\\by trained\\staff\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Privacy\\during\\exam\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Received\\test when\\needed\end{tabular} "
				"\begin{tabular}[c]{@{}c@{}}Diagnosis\\explained\\clearly\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}\% staff\\presence\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Facility\\cleanliness\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Drug\\availability\end{tabular}")
		stats(N r2 f_wald f_wald1 f_wald2 hline f_3 f_wald3, labels("N" "R$^{2}$" "P-value (Information and mobilization = Interface)" "P-value (Information = Full treatment)" "P-value (Interface = Full treatment)" "\hline" "F-test (joint significance of all 3 treatment groups)" "P-value (joint significance of all 3 treatment groups)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	*****************************************************************
	* Table I42: Patient satisfaction outcomes – All treatment arms *
	*****************************************************************
	
	* We work on the coefficient plot and figures for the patient satisfaction indice
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `patsat' {
		areg e_`x' fullomn infomn intomn b_`x' b_`x'_d `fullomn_int_e_controls' `e_controls' `infomn_int_e_controls' `intomn_int_e_controls', robust cl(hc_id) a(district)
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(F)
		estadd scalar f_wald3 = r(p)
		
		estimates store m`y'
		
		local y = `y' + 1
		}
		
	* No baseline outcome
	
	local y = 8
	foreach x in `patsat_nobaseline' {
		areg e_`x' fullomn infomn intomn `fullomn_int_e_controls' `e_controls' `infomn_int_e_controls' `intomn_int_e_controls', robust cl(hc_id) a(district)
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(F)
		estadd scalar f_wald3 = r(p)
		
		estimates store m`y'
		
		}

	# delimit;
	
	esttab m1 m8 m2 m3 m4 m5 m6 m7
	using "${tables}/TableI42.tex", b(%5.3f) se(%5.3f)
		title(Patient satisfaction outcomes -- All treatment arms)
		keep(fullomn infomn intomn _cons)
		varlabels (fullomn "Full treatment" infomn "Information and mobilization only" intomn "Interface only" _cons "Constant")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Patient\\satisfaction\\index\end{tabular}}"
				"\begin{tabular}[c]{@{}c@{}}Satisfied by\\HC quality\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Satisfied\\with quality\\of care\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Polite\\staff\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Staff\\interested\\in health\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Staff\\listening\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Free to\\express\\clearly\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}} Availability\\of staff\\improving\end{tabular}")
		stats(N r2 f_wald f_wald1 f_wald2 hline f_3 f_wald3, labels("N" "R$^{2}$" "P-value (Information and mobilization = Interface)" "P-value (Information and mobilization = Full treatment)" "P-value (Interface = Full treatment)" "\hline" "F-test (joint significance of all 3 treatment groups)" "P-value (joint significance of all 3 treatment groups)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	**********************************************************************
	* Table I43: Health outcomes at the child level – All treatment arms *
	**********************************************************************
	
	use "${usedata}/healthoutcome_endline_ind.dta", clear

	* We work on the coefficient plot and tables for the health outcome indice
	
	* We regress the main outcomes
	
	areg e_healthoutcome_z fullomn infomn intomn b_healthoutcome_z b_healthoutcome_z_d  `controls'  `fullomn_int_controls' `infomn_int_controls' `intomn_int_controls', robust cl(hc_id) a(district)
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(F)
		estadd scalar f_wald3 = r(p)
		
		estimates store m1
		
	* We take care of the rest of the cohort
	
	local z = 1
		foreach y in _weight18_z  _muac18_z {
			
			local z = `z' + 1
			
			areg  e`y' fullomn infomn intomn b`y' b`y'_d  `controls'  `fullomn_ho1_controls' `infomn_ho1_controls' `intomn_ho1_controls', robust cl(hc_id) a(district) 
			
			test infomn = intomn
			estadd scalar f_wald = r(p)
		
			test infomn = fullomn
			estadd scalar f_wald1 = r(p)
		
			test intomn = fullomn
			estadd scalar f_wald2 = r(p)
			
			test fullomn infomn intomn
			estadd scalar f_3 = r(F)
			estadd scalar f_wald3 = r(p)
			
			estimates store m`z'
			
			}
		
	local z = 3
		foreach y in _weight36_z  _muac36_z {
			
			local z = `z' + 1
			
			areg  e`y' fullomn infomn intomn b`y' b`y'_d  `controls'  `fullomn_ho2_controls' `infomn_ho2_controls' `intomn_ho2_controls', robust cl(hc_id) a(district) 
			
			test infomn = intomn
			estadd scalar f_wald = r(p)
		
			test infomn = fullomn
			estadd scalar f_wald1 = r(p)
		
			test intomn = fullomn
			estadd scalar f_wald2 = r(p)
			
			test fullomn infomn intomn
			estadd scalar f_3 = r(F)
			estadd scalar f_wald3 = r(p)
			
			estimates store m`z'
			
			}

	* We outsheet the results
	
	# delimit;
	
	esttab m1 m2 m3 m4 m5
	using "${tables}/TableI43.tex", b(%5.3f) se(%5.3f)
		title(Health outcome at the child level -- All treatments)
		keep(fullomn infomn intomn _cons)
		varlabels (fullomn "Full treatment" infomn "Information only" intomn "Interface only" _cons "Constant")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Health outcomes\\index\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Weight/Age\\0-18 months\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}MUAC\\0-18 months\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Weight/Age\\18-36 months\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}MUAC\\18-36 months\end{tabular}}")
		stats(N r2 f_wald f_wald1 f_wald2 hline f_3 f_wald3, labels("N" "R$^{2}$" "P-value (Information = Interface)" "P-value (Information = Full treatment)" "P-value (Interface = Full treatment)" "\hline" "F-test (joint significance of all 3 treatment groups)" "P-value (joint significance of all 3 treatment groups)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	*******************************************************************
	* Table I44: Child mortality at the HC level – All treatment arms *
	*******************************************************************
	
	* We work on the coefficient plot and tables for the health outcome indice
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* At endline:
	
	eststo clear
	
	local y = 1
	foreach x in `childmortality' {
		areg  e_`x' fullomn infomn intomn b_`x' `fullomn_hc_int_e_controls' `e_controls_hc' `infomn_hc_int_e_controls' `intomn_hc_int_e_controls' if uniquehc == 1 , robust a(district)
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(F)
		estadd scalar f_wald3 = r(p)
		
		estimates store m`y'
		
		local y = `y' + 1
		
		}
		
		
	# delimit;
	
	esttab m1 m2 m3
	using "${tables}/TableI44.tex", b(%5.3f) se(%5.3f)
		title(Child mortality outcomes -- All treatment arms)
		keep(fullomn infomn intomn _cons)
		varlabels (fullomn "Full treatment" infomn "Information and mobilization only" intomn "Interface only" _cons "Constant")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\begin{tabular}[c]{@{}c@{}}Child\\mortality\\0-5 years old\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Child mortality\\0-1 year old\end{tabular}"
				"\begin{tabular}[c]{@{}c@{}}Child mortality\\1-5 years old\end{tabular}")
		stats(N r2 f_wald f_wald1 f_wald2 hline f_3 f_wald3, labels("N" "R$^{2}$" "P-value (Information = Interface)" "P-value (Information = Full treatment)" "P-value (Interface = Full treatment)" "\hline" "F-test (joint significance of all 3 treatment groups)" "P-value (joint significance of all 3 treatment groups)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	**********************************************************************
	* Table I45: Child mortality at the child level – All treatment arms *
	**********************************************************************

	eststo clear
	
	use "${usedata}/mortality_endline_ind.dta", clear
	
	* We regress the results at endline for each bracket concerned in the PAP
	
	* We regress with birth month and synthetic cohort approach baseline HC level
	
	local y = 1
	
	foreach bracket in 05 01 15{
		
		stset e_survmonths_ab_`bracket', failure(dead_endline==1) id(childroster_id)
		stcox fullomn infomn intomn `controls_`bracket'' `fullomn_`bracket'_controls' `infomn_`bracket'_controls' `intomn_`bracket'_controls' e_birthmonth b_mortrate_`bracket' if e_agebracket_`bracket' == 1, vce(cluster hc_id)
		
		stphtest, detail
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(chi2)
		estadd scalar f_wald3 = r(p)
		
		estimate store m`y'
		
		local y = `y' + 1
		
		}
		
	# delimit;
	
	esttab m1 m2 m3
	using "${tables}/TableI45.tex", b(%5.3f) se(%5.3f) eform
		title(Child mortality at the child level)
		keep(fullomn infomn intomn)
		varlabels (fullomn "Full treatment" infomn "Information only" intomn "Interface only")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}0-5 years old\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}0-1 year old\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}1-5 years old\end{tabular}}")
		stats(N r2 f_wald f_wald1 f_wald2 hline f_3 f_wald3, labels("N" "R$^{2}$" "P-value (Information = Interface)" "P-value (Information = Full treatment)" "P-value (Interface = Full treatment)" "\hline" "F-test (joint significance of all 3 treatment groups)" "P-value (joint significance of all 3 treatment groups)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	;
	
	# delimit cr
	
	***************************************************************************************
	* Table I46: Robustness check – Excluding control variables interacted with treatment *
	***************************************************************************************

	* We include a version with only the basic set of controls due to collinearity
	
	eststo clear
	
	local y = 1
	foreach bracket in 05 01 15{
		
		stset e_survmonths_ab_`bracket', failure(dead_endline==1) id(childroster_id)
		stcox fullomn infomn intomn `controls_`bracket'' e_birthmonth b_mortrate_`bracket' if e_agebracket_`bracket' == 1, vce(cluster hc_id)
		
		stphtest, detail
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(chi2)
		estadd scalar f_wald3 = r(p)
		
		estimate store m`y'
		
		local y = `y' + 1
		
		}
			
	# delimit;
	
	esttab m1 m2 m3
	using "${tables}/TableI46.tex", b(%5.3f) se(%5.3f) eform
		title(Child mortality at the child level -- no interaction control variable)
		keep(fullomn infomn intomn)
		varlabels (fullomn "Full treatment" infomn "Information only" intomn "Interface only")
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}0-5 years old\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}0-1 year old\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}1-5 years old\end{tabular}}")
		stats(N r2 f_wald f_wald1 f_wald2 hline f_3 f_wald3, labels("N" "R$^{2}$" "P-value (Information = Interface)" "P-value (Information = Full treatment)" "P-value (Interface = Full treatment)" "\hline" "F-test (joint significance of all 3 treatment groups)" "P-value (joint significance of all 3 treatment groups)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	;
	
	# delimit cr
	
	**********************************************************
	* Table I47: Intermediates outcomes – All treatment arms *
	**********************************************************

	* We work on the coefficient plot and tables for the intermediate outcome indice
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* At endline:
	
	local intermediate ctzknow_z eff_z commresp_z relhhhc_z
	local intermediate_hclevel h_hcpknow_z h_hctrans_z

	eststo clear
	
	local y = 1
	
	foreach x in `intermediate' {
		
		areg  e_`x' fullomn infomn intomn b_`x' b_`x'_d `fullomn_int_e_controls' `e_controls' `infomn_int_e_controls' `intomn_int_e_controls', robust cl(hc_id) a(district)
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(F)
		estadd scalar f_wald3 = r(p)
		
		estimates store m`y'
		
		local y = `y' + 1
		
		}
		
	* HC level outcome
	
	local y = 6
	foreach x in `intermediate_hclevel' {
		
		areg  e_`x' fullomn infomn intomn b_`x' b_`x'_d `fullomn_hc_int_e_controls' `e_controls_hc' `infomn_hc_int_e_controls' `intomn_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		test infomn = intomn
		estadd scalar f_wald = r(p)
		
		test infomn = fullomn
		estadd scalar f_wald1 = r(p)
		
		test intomn = fullomn
		estadd scalar f_wald2 = r(p)
		
		test fullomn infomn intomn
		estadd scalar f_3 = r(F)
		estadd scalar f_wald3 = r(p)
		
		estimates store m`y'
		
		local y = `y' + 1
		
		}
		
	
	# delimit;
	
	esttab m1 m6 m2 m3 m4 m7
	using "${tables}/TableI47.tex", b(%5.3f) se(%5.3f)
		title(Intermediates outcomes -- All treatments)
		keep(fullomn infomn intomn _cons)
		varlabels (fullomn "Full treatment" infomn "Information and mobilization only" intomn "Interface only" _cons "Constant")
		starlevels(* .10 ** .05 *** .01)		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Citizen\\knowledge\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}HC staff\\knowledge\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Efficacy\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Community\\responsibility\end{tabular}}"	
				"\textbf{\begin{tabular}[c]{@{}c@{}}Relationship\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}HC\\transparency\end{tabular}}")
		stats(N r2 f_wald f_wald1 f_wald2 hline f_3 f_wald3, labels("N" "R$^{2}$" "P-value (Information = Interface)" "P-value (Information = Full treatment)" "P-value (Interface = Full treatment)" "\hline" "F-test (joint significance of all 3 treatment groups)" "P-value (joint significance of all 3 treatment groups)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	*************************************************
	* Table I48: Main outcomes – All treatment arms *
	*************************************************
	
	* We create another arms called infointer which corresponds to the interraction term
	
	* Interface only & Information only
	
	gen treatinfint = (treatfull == 1)
	la var treatinfint "Inter&Info - Not"
	
	* We create the new interaction for the endline
	
	local e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
	
	foreach x of local e_controls_noprefix {
	
		gen c_infint_`x' = treatinfint * c_`x'
		lab var c_infint_`x' "Interaction term of contral variable `x' with interaction treatment"
		
		gen c_infint_hc_`x' = treatinfint * c_hc_`x'
		lab var c_infint_hc_`x' "Interaction term of contral variable `x' with interaction treatment at household level"
	
		
		}
		
	* Following the PAP, we need to set the following control variables
	
		** An indicator variable taking the value 1 if a health center is a HCII
		** An indicator variable for whether the facility provides official delivery services
		** An indicator variable for whether a health center has staff houses
		** Whether household members report having used this health facility within the 12 months prior to the baseline
		** Average education level of the female head of household in health center catchment area, measured in years of education
		** Average household wealth level in the health center catchment area, calculated as the first component of a principal component analysis of the number of items of 17 assets (including cattle, radios, bicycles etc.) owned by the household.
		
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	* We create the set of locals for the control variable for the main indices
	
	foreach x in e_ {
	
		local `x'controls
		local `x'controls_hc
		
		}
		
	foreach var in treatinfint treatinfo treatinter {
			
		local `var'_int_e_controls
		local `var'_hc_int_e_controls
		
		}
		
		
	* We populate the set of locals for the control variable for the main indices
	
	foreach var of local e_controls_noprefix {
		
		local e_controls `e_controls' c_`var'
		local e_controls_hc `e_controls_hc' c_hc_`var'
		
		}
						
	foreach treat in infint treatinfo treatinter {
		foreach var of local e_controls_noprefix {
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			}
		}
		
	eststo clear
	
	* We regress our main indices
	
	foreach x in `indices' {
		areg  e_`x' treatinfo treatinter treatinfint b_`x' b_`x'_d  `infint_int_e_controls' `e_controls' `treatinfo_int_e_controls' `treatinter_int_e_controls', robust cl(hc_id) a(district)
		
		local n_1_`x' = string(`e(N)',"%9.0fc")
		
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[treatinfo],"%9.3fc")
		local se_1_`x' = string(_se[treatinfo],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[treatinfo]/_se[treatinfo])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[treatinter],"%9.3fc")
		local se_2_`x' = string(_se[treatinter],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[treatinter]/_se[treatinter])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local e_3_`x' = string(_b[treatinfint],"%9.3fc")
		local se_3_`x' = string(_se[treatinfint],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[treatinfint]/_se[treatinfint])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''***"
				}
				
		local est_4_`x' = string(_b[_cons],"%9.3fc")
		local se_4_`x' = string(_se[_cons],"%9.3fc")
		local p_4_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
	
		lincom treatinfo + treatinfint
		local est_5_`x' = string(`r(estimate)',"%9.3fc")
		local se_5_`x' = string(`r(se)',"%9.3fc")
		local se_5_`x' = "(`se_5_`x'')"
		test treatinfo + treatinfint = 0
		local p_5_`x' = `r(p)'
		
		gen s_5_1s_`x' = (`p_5_`x''<=0.1 & `p_5_`x''>0.05)
		gen s_5_2s_`x' = (`p_5_`x''<=0.05 & `p_5_`x''>0.01)
		gen s_5_3s_`x' = (`p_5_`x''<=0.01 & `p_5_`x''>=0)
	
		if s_5_1s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''*"
				}
				
		if s_5_2s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''**"
				}
				
		if s_5_3s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''***"
				}
		
		test treatinfo = treatinter
		local f_wald_`x' = string(`r(p)',"%9.3fc")
		
		drop s_*
		}
		
	* Child mortality at HC level
	
	foreach x in `indices_hc' {
		areg  e_`x' treatinfo treatinter treatinfint b_`x' `infint_hc_int_e_controls' `e_controls_hc' `treatinfo_hc_int_e_controls' `treatinter_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		local n_1_`x' = string(`e(N)',"%9.0fc")
		
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[treatinfo],"%9.3fc")
		local se_1_`x' = string(_se[treatinfo],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[treatinfo]/_se[treatinfo])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[treatinter],"%9.3fc")
		local se_2_`x' = string(_se[treatinter],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[treatinter]/_se[treatinter])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local e_3_`x' = string(_b[treatinfint],"%9.3fc")
		local se_3_`x' = string(_se[treatinfint],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[treatinfint]/_se[treatinfint])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''***"
				}
				
		local est_4_`x' = string(_b[_cons],"%9.3fc")
		local se_4_`x' = string(_se[_cons],"%9.3fc")
		local p_4_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
	
		lincom treatinfo + treatinfint
		local est_5_`x' = string(`r(estimate)',"%9.3fc")
		local se_5_`x' = string(`r(se)',"%9.3fc")
		local se_5_`x' = "(`se_5_`x'')"
		test treatinfo + treatinfint = 0
		local p_5_`x' = `r(p)'
		
		gen s_5_1s_`x' = (`p_5_`x''<=0.1 & `p_5_`x''>0.05)
		gen s_5_2s_`x' = (`p_5_`x''<=0.05 & `p_5_`x''>0.01)
		gen s_5_3s_`x' = (`p_5_`x''<=0.01 & `p_5_`x''>=0)
	
		if s_5_1s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''*"
				}
				
		if s_5_2s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''**"
				}
				
		if s_5_3s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''***"
				}
		
		test treatinfo = treatinter
		local f_wald_`x' = string(`r(p)',"%9.3fc")
		
		drop s_*
		}
		
	foreach x in `indices_hc_ols' {
		
		areg  e_`x' treatinfo treatinter treatinfint b_`x' b_`x'_d `infint_hc_e_controls' `e_controls_hc' `treatinfo_hc_int_e_controls' `treatinter_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
		local n_1_`x' = string(`e(N)',"%9.0fc")
		
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[treatinfo],"%9.3fc")
		local se_1_`x' = string(_se[treatinfo],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[treatinfo]/_se[treatinfo])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[treatinter],"%9.3fc")
		local se_2_`x' = string(_se[treatinter],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[treatinter]/_se[treatinter])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local e_3_`x' = string(_b[treatinfint],"%9.3fc")
		local se_3_`x' = string(_se[treatinfint],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[treatinfint]/_se[treatinfint])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''***"
				}
				
		local est_4_`x' = string(_b[_cons],"%9.3fc")
		local se_4_`x' = string(_se[_cons],"%9.3fc")
		local p_4_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
	
		lincom treatinfo + treatinfint
		local est_5_`x' = string(`r(estimate)',"%9.3fc")
		local se_5_`x' = string(`r(se)',"%9.3fc")
		local se_5_`x' = "(`se_5_`x'')"
		test treatinfo + treatinfint = 0
		local p_5_`x' = `r(p)'
		
		gen s_5_1s_`x' = (`p_5_`x''<=0.1 & `p_5_`x''>0.05)
		gen s_5_2s_`x' = (`p_5_`x''<=0.05 & `p_5_`x''>0.01)
		gen s_5_3s_`x' = (`p_5_`x''<=0.01 & `p_5_`x''>=0)
	
		if s_5_1s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''*"
				}
				
		if s_5_2s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''**"
				}
				
		if s_5_3s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''***"
				}
		
		test treatinfo = treatinter
		local f_wald_`x' = string(`r(p)',"%9.3fc")
		
		drop s_*
		}
		
	* Health outcomes
	
	use "${usedata}/healthoutcome_endline_ind.dta", clear 
	
	* We regress the healthoutcome of endline
	
	local x healthout_z
		
	areg  e_healthoutcome_z treatinfo treatinter treatinfint b_healthoutcome_z b_healthoutcome_z_d  `infint_int_e_controls' `e_controls' `treatinfo_int_e_controls' `treatinter_int_e_controls', robust cl(hc_id) a(district)
		
		local n_1_`x' = string(`e(N)',"%9.0fc")
		
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[treatinfo],"%9.3fc")
		local se_1_`x' = string(_se[treatinfo],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[treatinfo]/_se[treatinfo])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[treatinter],"%9.3fc")
		local se_2_`x' = string(_se[treatinter],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[treatinter]/_se[treatinter])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local e_3_`x' = string(_b[treatinfint],"%9.3fc")
		local se_3_`x' = string(_se[treatinfint],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[treatinfint]/_se[treatinfint])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''***"
				}
				
		local est_4_`x' = string(_b[_cons],"%9.3fc")
		local se_4_`x' = string(_se[_cons],"%9.3fc")
		local p_4_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
	
		lincom treatinfo + treatinfint
		local est_5_`x' = string(`r(estimate)',"%9.3fc")
		local se_5_`x' = string(`r(se)',"%9.3fc")
		local se_5_`x' = "(`se_5_`x'')"
		test treatinfo + treatinfint = 0
		local p_5_`x' = `r(p)'
		
		gen s_5_1s_`x' = (`p_5_`x''<=0.1 & `p_5_`x''>0.05)
		gen s_5_2s_`x' = (`p_5_`x''<=0.05 & `p_5_`x''>0.01)
		gen s_5_3s_`x' = (`p_5_`x''<=0.01 & `p_5_`x''>=0)
	
		if s_5_1s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''*"
				}
				
		if s_5_2s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''**"
				}
				
		if s_5_3s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''***"
				}
		
		test treatinfo = treatinter
		local f_wald_`x' = string(`r(p)',"%9.3fc")
		
		drop s_*
		
	
	* We create the tables concerning the results of the main indices
	
	texdoc init "${tables}/TableI48.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \footnotesize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Main outcomes -- All treatments}
	tex \begin{tabular}{lgggggggg}
	tex \toprule
	tex 											  & (1)                       & (2)                                                          & (3)                                                             & (4)                                                        & (5) & (6) & (7)                       \\
    tex \multirow{-2}{*}{}                          & \textbf{\begin{tabular}[c]{@{}c@{}}Citizen \\ monitoring\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Perceived \\ citizen \\ pressure\end{tabular}}     & \textbf{Utilization}      & \textbf{\begin{tabular}[c]{@{}c@{}}Treatment \\ quality\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Patient \\ satisfaction\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Health \\ outcomes\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Child \\ mortality\end{tabular}}        \\
	tex \midrule
	tex \multirow{2}{*}{Information}  & `est_1_commtg_z' & `est_1_h_ctzpressure_z' & `est_1_urate_z'           & `est_1_treatqual_z'                                                            & `est_1_patsat_z'                                                               & `est_1_healthout_z'                                                          & `est_1_mortrate_05'         \\
	tex  & (`se_1_commtg_z') & (`se_1_h_ctzpressure_z')  & (`se_1_urate_z')           & (`se_1_treatqual_z')                                                            & (`se_1_patsat_z')                                                               & (`se_1_healthout_z')                                                          & (`se_1_mortrate_05')         \\
	tex \multirow{2}{*}{Interface}  & `est_2_commtg_z' & `est_2_h_ctzpressure_z' & `est_2_urate_z'           & `est_2_treatqual_z'                                                            & `est_2_patsat_z'                                                               & `est_2_healthout_z'                                                          & `est_2_mortrate_05'         \\
	tex  & (`se_2_commtg_z') & (`se_2_h_ctzpressure_z') & (`se_2_urate_z')           & (`se_2_treatqual_z')                                                            & (`se_2_patsat_z')                                                               & (`se_2_healthout_z')                                                          & (`se_2_mortrate_05')         \\
	tex \multirow{2}{*}{Information x Interface}  & `e_3_commtg_z' & `e_3_h_ctzpressure_z' & `e_3_urate_z'           & `e_3_treatqual_z'                                                            & `e_3_patsat_z'                                                               & `e_3_healthout_z'                                                          & `e_3_mortrate_05'         \\
	tex  & (`se_3_commtg_z') & (`se_3_h_ctzpressure_z') & (`se_3_urate_z')           & (`se_3_treatqual_z')                                                            & (`se_3_patsat_z')                                                               & (`se_3_healthout_z')                                                          & (`se_3_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}  & `est_4_commtg_z' & `est_4_h_ctzpressure_z'  & `est_4_urate_z'           & `est_4_treatqual_z'                                                            & `est_4_patsat_z'                                                               & `est_4_healthout_z'                                                          & `est_4_mortrate_05'         \\
	tex  & (`se_4_commtg_z') & (`se_4_h_ctzpressure_z') & (`se_4_urate_z')           & (`se_4_treatqual_z')                                                            & (`se_4_patsat_z')                                                               & (`se_4_healthout_z')                                                          & (`se_4_mortrate_05')         \\
	tex \midrule
	tex \multirow{1}{*}{N} & `n_1_commtg_z' & `n_1_h_ctzpressure_z' & `n_1_urate_z'           & `n_1_treatqual_z'                                                            & `n_1_patsat_z'                                                             & `n_1_healthout_z'                                                          & `n_1_mortrate_05'         \\
	tex \multirow{1}{*}{R$^{2}$}   & `r2_1_commtg_z'  & `r2_1_h_ctzpressure_z'  & `r2_1_urate_z'           & `r2_1_treatqual_z'                                                           & `r2_1_patsat_z'                                                               & `r2_1_healthout_z'                                                         & `r2_1_mortrate_05'         \\
	tex \multirow{2}{*}{Informantion + Information x Interface}   & `est_5_commtg_z' & `est_5_h_ctzpressure_z'  & `est_5_urate_z'           & `est_5_treatqual_z'                                                            & `est_5_patsat_z'                                                              & `est_5_healthout_z'                                                          & `est_5_mortrate_05'         \\
	tex & `se_5_commtg_z' & `se_5_h_ctzpressure_z' & `se_5_urate_z'           & `se_5_treatqual_z'                                                            & `se_5_patsat_z'                                                              & `se_5_healthout_z'                                                          & `se_5_mortrate_05'         \\
	tex \multirow{1}{*}{P-value (Information = Interface)}           & `f_wald_commtg_z'   & `f_wald_h_ctzpressure_z'              & `f_wald_urate_z'           & `f_wald_treatqual_z'                                                            & `f_wald_patsat_z'                                                              & `f_wald_healthout_z'                                                          & `f_wald_mortrate_05'         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	**********************************************************
	* Table I49: Intermediates outcomes – All treatment arms *
	**********************************************************
	
	* At endline:
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* We create another arms called infointer which corresponds to the interraction term
	
	* Interface only & Information only
	
	gen treatinfint = (treatfull == 1)
	la var treatinfint "Inter&Info - Not"
	
	* We create the new interaction for the endline
	
	local e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
	
	foreach x of local e_controls_noprefix {
	
		gen c_infint_`x' = treatinfint * c_`x'
		lab var c_infint_`x' "Interaction term of contral variable `x' with interaction treatment"
		
		gen c_infint_hc_`x' = treatinfint * c_hc_`x'
		lab var c_infint_hc_`x' "Interaction term of contral variable `x' with interaction treatment at household level"
		
		}
		
		* Following the PAP, we need to set the following control variables
	
		** An indicator variable taking the value 1 if a health center is a HCII
		** An indicator variable for whether the facility provides official delivery services
		** An indicator variable for whether a health center has staff houses
		** Whether household members report having used this health facility within the 12 months prior to the baseline
		** Average education level of the female head of household in health center catchment area, measured in years of education
		** Average household wealth level in the health center catchment area, calculated as the first component of a principal component analysis of the number of items of 17 assets (including cattle, radios, bicycles etc.) owned by the household.
		
	local  e_controls_noprefix hc2 b_h_del b_h_staff_houses b_visited_d educyr b_assetindex
		
	* We create the set of locals for the control variable for the main indices
	
	foreach x in e_ {
	
		local `x'controls
		local `x'controls_hc
		
		}
		
	foreach var in treatinfint treatinfo treatinter {
			
		local `var'_int_e_controls
		local `var'_hc_int_e_controls
		
		}
		
		
	* We populate the set of locals for the control variable for the main indices
	
	foreach var of local e_controls_noprefix {
		
		local e_controls `e_controls' c_`var'
		local e_controls_hc `e_controls_hc' c_hc_`var'
		
		}
						
	foreach treat in infint treatinfo treatinter {
		foreach var of local e_controls_noprefix {
			local `treat'_int_e_controls ``treat'_int_e_controls' c_`treat'_`var'
			local `treat'_hc_int_e_controls ``treat'_hc_int_e_controls' c_`treat'_hc_`var'
			}
		}
		
	eststo clear
	
	* HH level outcomes
	
	foreach x in `intermediate' {
		areg  e_`x' treatinfo treatinter treatinfint b_`x' b_`x'_d `e_controls' `infint_int_e_controls' `treatinfo_int_e_controls' `treatinter_int_e_controls', robust cl(hc_id) a(district)
		local n_1_`x' = `e(N)'
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[treatinfo],"%9.3fc")
		local se_1_`x' = string(_se[treatinfo],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[treatinfo]/_se[treatinfo])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[treatinter],"%9.3fc")
		local se_2_`x' = string(_se[treatinter],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[treatinter]/_se[treatinter])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local e_3_`x' = string(_b[treatinfint],"%9.3fc")
		local se_3_`x' = string(_se[treatinfint],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[treatinfint]/_se[treatinfint])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''***"
				}
				
		local est_4_`x' = string(_b[_cons],"%9.3fc")
		local se_4_`x' = string(_se[_cons],"%9.3fc")
		local p_4_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
	
		lincom treatinfo + treatinfint
		local est_5_`x' = string(`r(estimate)',"%9.3fc")
		local se_5_`x' = string(`r(se)',"%9.3fc")
		local se_5_`x' = "(`se_5_`x'')"
		test treatinfo + treatinfint = 0
		local p_5_`x' = `r(p)'
		
		gen s_5_1s_`x' = (`p_5_`x''<=0.1 & `p_5_`x''>0.05)
		gen s_5_2s_`x' = (`p_5_`x''<=0.05 & `p_5_`x''>0.01)
		gen s_5_3s_`x' = (`p_5_`x''<=0.01 & `p_5_`x''>=0)
	
		if s_5_1s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''*"
				}
				
		if s_5_2s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''**"
				}
				
		if s_5_3s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''***"
				}
		
		test treatinfo = treatinter
		local f_wald_`x' = string(`r(p)',"%9.3fc")
		
		drop s_*
		}
		
	* HC level outcomes
	
	foreach x in `intermediate_hclevel' {
		areg  e_`x' treatinfo treatinter treatinfint b_`x' b_`x'_d `infint_hc_int_e_controls' `e_controls_hc' `treatinfo_hc_int_e_controls' `treatinter_hc_int_e_controls' if uniquehc == 1, robust a(district)
		local n_1_`x' = `e(N)'
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[treatinfo],"%9.3fc")
		local se_1_`x' = string(_se[treatinfo],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[treatinfo]/_se[treatinfo])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[treatinter],"%9.3fc")
		local se_2_`x' = string(_se[treatinter],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[treatinter]/_se[treatinter])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local e_3_`x' = string(_b[treatinfint],"%9.3fc")
		local se_3_`x' = string(_se[treatinfint],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[treatinfint]/_se[treatinfint])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''***"
				}
				
		local est_4_`x' = string(_b[_cons],"%9.3fc")
		local se_4_`x' = string(_se[_cons],"%9.3fc")
		local p_4_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
	
		lincom treatinfo + treatinfint
		local est_5_`x' = string(`r(estimate)',"%9.3fc")
		local se_5_`x' = string(`r(se)',"%9.3fc")
		local se_5_`x' = "(`se_5_`x'')"
		test treatinfo + treatinfint = 0
		local p_5_`x' = `r(p)'
		
		gen s_5_1s_`x' = (`p_5_`x''<=0.1 & `p_5_`x''>0.05)
		gen s_5_2s_`x' = (`p_5_`x''<=0.05 & `p_5_`x''>0.01)
		gen s_5_3s_`x' = (`p_5_`x''<=0.01 & `p_5_`x''>=0)
	
		if s_5_1s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''*"
				}
				
		if s_5_2s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''**"
				}
				
		if s_5_3s_`x' == 1 {
				local est_5_`x' = "`est_5_`x''***"
				}
		
		test treatinfo = treatinter
		local f_wald_`x' = string(`r(p)',"%9.3fc")
		
		drop s_*
		}
	
	texdoc init "${tables}/TableI49.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \footnotesize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Intermediates outcomes: subcomponents}
	tex \begin{tabular}{lgggggg}
	tex \toprule
	tex 											  & (1)                       & (2)                                                          & (3)                                                             & (4)           & (5) & (6)                                                                    \\
    tex \multirow{-2}{*}{}                              & \textbf{\begin{tabular}[c]{@{}c@{}}Citizen\\knowledge\end{tabular}}      & \textbf{\begin{tabular}[c]{@{}c@{}}HC staff\\knowledge\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Efficacy\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Community\\responsibility\end{tabular}}  & \begin{tabular}[c]{@{}c@{}}Relationship\end{tabular} & \begin{tabular}[c]{@{}c@{}}HC\\transparency\end{tabular} \\
	tex \midrule
	tex \multirow{2}{*}{Information}  & `est_1_ctzknow_z'           & `est_1_h_hcpknow_z'                                                            & `est_1_eff_z'                                                               & `est_1_commresp_z'         & `est_1_relhhhc_z'   & `est_1_h_hctrans_z'                          \\
	tex  & `se_1_ctzknow_z'           & `se_1_h_hcpknow_z'                                                            & `se_1_eff_z'                                                               & `se_1_commresp_z'                    & `se_1_relhhhc_z'   & `se_1_h_hctrans_z'     \\
	tex \multirow{2}{*}{Interface}  & `est_2_ctzknow_z'           & `est_2_h_hcpknow_z'                                                            & `est_2_eff_z'                                                               & `est_2_commresp_z'             & `est_2_relhhhc_z'   & `est_2_h_hctrans_z'                                                       \\
	tex  & `se_2_ctzknow_z'           & `se_2_h_hcpknow_z'                                                            & `se_2_eff_z'                                                               & `se_2_commresp_z'                & `se_2_relhhhc_z'   & `se_2_h_hctrans_z'                                                       \\
	tex \multirow{2}{*}{Information x Interface}  & `e_3_ctzknow_z'           & `e_3_h_hcpknow_z'                                                            & `e_3_eff_z'                                                               & `e_3_commresp_z'            & `e_3_relhhhc_z'   & `e_3_h_hctrans_z'                                                           \\
	tex  & `se_3_ctzknow_z'           & `se_3_h_hcpknow_z'                                                            & `se_3_eff_z'                                                               & `se_3_commresp_z'                         & `se_3_relhhhc_z'   & `se_3_h_hctrans_z'                                             \\
	tex \multirow{2}{*}{Constant}  & `est_4_ctzknow_z'           & `est_4_h_hcpknow_z'                                                            & `est_4_eff_z'                                                               & `est_4_commresp_z'                 & `est_4_relhhhc_z'   & `est_4_h_hctrans_z'                                                         \\
	tex  & `se_4_ctzknow_z'           & `se_4_h_hcpknow_z'                                                            & `se_4_eff_z'                                                               & `se_4_commresp_z'                                                                    & `se_4_relhhhc_z'   & `se_4_h_hctrans_z'      \\
	tex \midrule
	tex \multirow{1}{*}{N} & `n_1_ctzknow_z'           & `n_1_h_hcpknow_z'                                                            & `n_1_eff_z'                                                             & `n_1_commresp_z'              & `n_1_relhhhc_z'   & `n_1_h_hctrans_z'                                                            \\
	tex \multirow{1}{*}{R$^{2}$}   & `r2_1_ctzknow_z'           & `r2_1_h_hcpknow_z'                                                           & `r2_1_eff_z'                                                               & `r2_1_commresp_z'                       & `r2_1_relhhhc_z'   & `r2_1_h_hctrans_z'                                               \\
	tex \multirow{2}{*}{Information + Information x Interface}   & `est_5_ctzknow_z'           & `est_5_h_hcpknow_z'                                                            & `est_5_eff_z'                                                              & `est_5_commresp_z'                 & `est_5_relhhhc_z'   & `est_5_h_hctrans_z'                                                         \\
	tex & `se_5_ctzknow_z'           & `se_5_h_hcpknow_z'                                                            & `se_5_eff_z'                                                              & `se_5_commresp_z'                      & `se_5_relhhhc_z'   & `se_5_h_hctrans_z'                                                   \\
	tex \multirow{1}{*}{P-value (Information = Interface)}                            & `f_wald_ctzknow_z'           & `f_wald_h_hcpknow_z'                                                            & `f_wald_eff_z'                                                              & `f_wald_commresp_z'             & `f_wald_relhhhc_z'   & `f_wald_h_hctrans_z'                                                         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	*******************************************************
	* Table I50: Main outcomes (midline) - Full treatment *
	*******************************************************
	
	* At endline:
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* At midline:
	
	local var treatfull
	
	* We regress our main indices
	
	local y = 1
	foreach x in `indices' {
		
		areg  m_`x' `var' bm_`x' bm_`x'_d `m_controls_tfull' ``var'_int_m_controls', robust cl(hc_id) a(district)
		
		estimates store mm`y'
		
		local n_1m_`x' = string(`e(N)',"%9.0fc")
		local r2_1m_`x' = string(`e(r2)',"%9.3fc")
		local est_1m_`x' = string(_b[`var'],"%9.3fc")
		local se_1m_`x' = string(_se[`var'],"%9.3fc")
		local p_1m_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		local p_`y'm = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1m_1s_`x' = (`p_1m_`x''<=0.1 & `p_1m_`x''>0.05)
		gen s_1m_2s_`x' = (`p_1m_`x''<=0.05 & `p_1m_`x''>0.01)
		gen s_1m_3s_`x' = (`p_1m_`x''<=0.01 & `p_1m_`x''>=0)
	
		if s_1m_1s_`x' == 1 {
				local est_1m_`x' = "`est_1m_`x''*"
				}
				
		if s_1m_2s_`x' == 1 {
				local est_1m_`x' = "`est_1m_`x''**"
				}
				
		if s_1m_3s_`x' == 1 {
				local est_1m_`x' = "`est_1m_`x''***"
				}
		
		local est_2m_`x' = string(_b[_cons],"%9.3fc")
		local se_2m_`x' = string(_se[_cons],"%9.3fc")
		local p_2m_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_2m_1s_`x' = (`p_2m_`x''<=0.1 & `p_2m_`x''>0.05)
		gen s_2m_2s_`x' = (`p_2m_`x''<=0.05 & `p_2m_`x''>0.01)
		gen s_2m_3s_`x' = (`p_2m_`x''<=0.01 & `p_2m_`x''>=0)
	
		if s_2m_1s_`x' == 1 {
				local est_2m_`x' = "`est_2m_`x''*"
				}
				
		if s_2m_2s_`x' == 1 {
				local est_2m_`x' = "`est_2m_`x''**"
				}
				
		if s_2m_3s_`x' == 1 {
				local est_2m_`x' = "`est_2m_`x''***"
				}
				
		test treatfull = 0
		local f_waldm_`x' = string(`r(p)',"%9.3fc")
		
				
		local y = `y' + 1
		}
		
	foreach x in `indices_hc_ols' {
		areg  m_`x' `var' bm_`x' bm_`x'_d `m_controls_tfull_hc' ``var'_hc_int_m_controls' if uniquehc == 1, robust a(district)
		
		estimates store mm`y'
		
		local n_1m_`x' = string(`e(N)',"%9.0fc")
		local r2_1m_`x' = string(`e(r2)',"%9.3fc")
		local est_1m_`x' = string(_b[`var'],"%9.3fc")
		local se_1m_`x' = string(_se[`var'],"%9.3fc")
		local p_1m_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		local p_`y'm = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1m_1s_`x' = (`p_1m_`x''<=0.1 & `p_1m_`x''>0.05)
		gen s_1m_2s_`x' = (`p_1m_`x''<=0.05 & `p_1m_`x''>0.01)
		gen s_1m_3s_`x' = (`p_1m_`x''<=0.01 & `p_1m_`x''>=0)
	
		if s_1m_1s_`x' == 1 {
				local est_1m_`x' = "`est_1m_`x''*"
				}
				
		if s_1m_2s_`x' == 1 {
				local est_1m_`x' = "`est_1m_`x''**"
				}
				
		if s_1m_3s_`x' == 1 {
				local est_1m_`x' = "`est_1m_`x''***"
				}
		
		local est_2m_`x' = string(_b[_cons],"%9.3fc")
		local se_2m_`x' = string(_se[_cons],"%9.3fc")
		local p_2m_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_2m_1s_`x' = (`p_2m_`x''<=0.1 & `p_2m_`x''>0.05)
		gen s_2m_2s_`x' = (`p_2m_`x''<=0.05 & `p_2m_`x''>0.01)
		gen s_2m_3s_`x' = (`p_2m_`x''<=0.01 & `p_2m_`x''>=0)
	
		if s_2m_1s_`x' == 1 {
				local est_2m_`x' = "`est_2m_`x''*"
				}
				
		if s_2m_2s_`x' == 1 {
				local est_2m_`x' = "`est_2m_`x''**"
				}
				
		if s_2m_3s_`x' == 1 {
				local est_2m_`x' = "`est_2m_`x''***"
				}
				
		test treatfull = 0
		local f_waldm_`x' = string(`r(p)',"%9.3fc")
		
		local y = `y' + 1
		}
	
	* Health outcome
	
	* At midline
	
	use "${usedata}/healthoutcome_midline_ind.dta", clear

	* Regressions at midline

	local var treatfull
	
	areg  m_healthoutcome_z treatfull b_healthoutcome_z b_healthoutcome_z_d `m_controls_tfull' ``var'_int_m_controls', robust cl(hc_id) a(district) 
		
		estimates store mm6
		
		local n_1m_healthout_z = string(`e(N)',"%9.0fc")
		local r2_1m_healthout_z = string(`e(r2)',"%9.3fc")
		local est_1m_healthout_z = string(_b[`var'],"%9.3fc")
		local se_1m_healthout_z = string(_se[`var'],"%9.3fc")
		local p_1m_healthout_z = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		local p_6m = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1m_1s_healthout_z = (`p_1m_healthout_z'<=0.1 & `p_1m_healthout_z'>0.05)
		gen s_1m_2s_healthout_z = (`p_1m_healthout_z'<=0.05 & `p_1m_healthout_z'>0.01)
		gen s_1m_3s_healthout_z = (`p_1m_healthout_z'<=0.01 & `p_1m_healthout_z'>=0)
	
		if s_1m_1s_healthout_z == 1 {
				local est_1m_healthout_z = "`est_1m_healthout_z'*"
				}
				
		if s_1m_2s_healthout_z == 1 {
				local est_1m_healthout_z = "`est_1m_healthout_z'**"
				}
				
		if s_1m_3s_healthout_z == 1 {
				local est_1m_healthout_z = "`est_1m_healthout_z'***"
				}
		
		local est_2m_healthout_z = string(_b[_cons],"%9.3fc")
		local se_2m_healthout_z = string(_se[_cons],"%9.3fc")
		local p_2m_healthout_z = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_2m_1s_healthout_z = (`p_2m_healthout_z'<=0.1 & `p_2m_healthout_z'>0.05)
		gen s_2m_2s_healthout_z = (`p_2m_healthout_z'<=0.05 & `p_2m_healthout_z'>0.01)
		gen s_2m_3s_healthout_z = (`p_2m_healthout_z'<=0.01 & `p_2m_healthout_z'>=0)
	
		if s_2m_1s_healthout_z == 1 {
				local est_2m_healthout_z = "`est_2m_healthout_z'*"
				}
				
		if s_2m_2s_healthout_z == 1 {
				local est_2m_healthout_z = "`est_2m_healthout_z'**"
				}
				
		if s_2m_3s_healthout_z == 1 {
				local est_2m_healthout_z = "`est_2m_healthout_z'***"
				}
				
		test treatfull = 0
		local f_waldm_healthout_z = string(`r(p)',"%9.3fc")	
				
	* Mortrate HC level (midline)
	
	use "${usedata}/chp_el_light_dataset.dta", clear
		
	local y = 7
	foreach x in `indices_hc' {
		areg  m_`x' `var' bm_`x' `m_controls_tfull_hc' ``var'_hc_int_m_controls' if uniquehc == 1, robust a(district)
		
		estimates store mm`y'
		
		local n_1m_`x' = string(`e(N)',"%9.0fc")
		local r2_1m_`x' = string(`e(r2)',"%9.3fc")
		local est_1m_`x' = string(_b[`var'],"%9.3fc")
		local se_1m_`x' = string(_se[`var'],"%9.3fc")
		local p_1m_`x' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		local p_`y'm = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		gen s_1m_1s_`x' = (`p_1m_`x''<=0.1 & `p_1m_`x''>0.05)
		gen s_1m_2s_`x' = (`p_1m_`x''<=0.05 & `p_1m_`x''>0.01)
		gen s_1m_3s_`x' = (`p_1m_`x''<=0.01 & `p_1m_`x''>=0)
	
		if s_1m_1s_`x' == 1 {
				local est_1m_`x' = "`est_1m_`x''*"
				}
				
		if s_1m_2s_`x' == 1 {
				local est_1m_`x' = "`est_1m_`x''**"
				}
				
		if s_1m_3s_`x' == 1 {
				local est_1m_`x' = "`est_1m_`x''***"
				}
		
		local est_2m_`x' = string(_b[_cons],"%9.3fc")
		local se_2m_`x' = string(_se[_cons],"%9.3fc")
		local p_2m_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_2m_1s_`x' = (`p_2m_`x''<=0.1 & `p_2m_`x''>0.05)
		gen s_2m_2s_`x' = (`p_2m_`x''<=0.05 & `p_2m_`x''>0.01)
		gen s_2m_3s_`x' = (`p_2m_`x''<=0.01 & `p_2m_`x''>=0)
	
		if s_2m_1s_`x' == 1 {
				local est_2m_`x' = "`est_2m_`x''*"
				}
				
		if s_2m_2s_`x' == 1 {
				local est_2m_`x' = "`est_2m_`x''**"
				}
				
		if s_2m_3s_`x' == 1 {
				local est_2m_`x' = "`est_2m_`x''***"
				}
		
		test treatfull = 0
		local f_waldm_`x' = string(`r(p)',"%9.3fc")
		
		}
		
	* We calculate the adjusted p-value
	
	* Midline
		
	local psm `p_1m'
	forvalues x = 2/`y' {
		local psm `psm' \ `p_`x'm'
		}

	matrix mat = (`psm')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat psm_mat = mat'
	
	mat list psm_mat
	
	local psm_rank
	
	forvalues z = 1/`y' {
		local x = psm_mat[1,`z']
		local psm_rank `psm_rank' `x'
		}
		
	di "`psm_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y'
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local psm_rank {
		local z = `z' + 1 
		local adj_p`z'm = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'm' >= `adj_p`v'm' {
				local adj_p`z'm `adj_p`v'm'
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local psm_rank {
		local z = `z' + 1 
		forvalues j = 1/`y' {
			if `i' == `p_`j'm' { 
			local adj_pm`j' = string(`adj_p`z'm',"%9.3fc")
			}
		}
		}
		
	* We create the tables concerning the results of the main indices
	
	texdoc init "${tables}/TableI50.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \footnotesize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Main outcomes (midline) - Full treatment}
	tex \begin{tabular}{lgggggggggg}
	tex \toprule
	tex 											  & (1)                       & (2)                                                          & (3)                                                             & (4)                                                        & (5)  & (6) & (7)                       \\
    tex \multirow{-2}{*}{}            & \textbf{\begin{tabular}[c]{@{}c@{}}Citizen \\ monitoring\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Perceived \\ citizen \\ pressure\end{tabular}}                    & \textbf{Utilization}      & \textbf{\begin{tabular}[c]{@{}c@{}}Treatment \\ quality\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Patient \\ satisfaction\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Health \\ outcomes\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Child \\ mortality\end{tabular}}        \\
	tex \midrule
	tex \multirow{2}{*}{Full treatment}  & `est_1m_commtg_z' & `est_1m_h_ctzpressure_z' & `est_1m_urate_z'           & `est_1m_treatqual_z'                                                            & `est_1m_patsat_z'                                                               & `est_1m_healthout_z'                                                          & `est_1m_mortrate_05'         \\
	tex  & (`se_1m_commtg_z') & (`se_1m_h_ctzpressure_z') & (`se_1m_urate_z')           & (`se_1m_treatqual_z')                                                            & (`se_1m_patsat_z')                                                               & (`se_1m_healthout_z')                                                         & (`se_1m_mortrate_05')         \\
	tex \multirow{2}{*}{Constant} & `est_2m_commtg_z' & `est_2m_h_ctzpressure_z' & `est_2m_urate_z'           & `est_2m_treatqual_z'                                                            & `est_2m_patsat_z'                                                              & `est_2m_healthout_z'                                                          & `est_2m_mortrate_05'         \\
	tex  & (`se_2m_commtg_z') & (`se_2m_h_ctzpressure_z') & (`se_2m_urate_z')           & (`se_2m_treatqual_z')                                                            & (`se_2m_patsat_z')                                                              & (`se_2m_healthout_z')                                                          & `se_2m_mortrate_05'         \\
	tex \midrule
	tex \multirow{1}{*}{N}  & `n_1m_commtg_z'  & `n_1m_h_ctzpressure_z' & `n_1m_urate_z'           & `n_1m_treatqual_z'                                                            & `n_1m_patsat_z'                                                           & `n_1m_healthout_z'                                                          & `n_1m_mortrate_05'         \\
	tex \multirow{1}{*}{R$^{2}$} & `r2_1m_commtg_z'  & `r2_1m_h_ctzpressure_z'  & `r2_1m_urate_z'           & `r2_1m_treatqual_z'                                                           & `r2_1m_patsat_z'                                                              & `r2_1m_healthout_z'                                                         & `r2_1m_mortrate_05'         \\
	tex \multirow{1}{*}{P-value (Full treatment = 0)}  & `f_waldm_commtg_z'  & `f_waldm_h_ctzpressure_z' & `f_waldm_urate_z'           & `f_waldm_treatqual_z'                                                            & `f_waldm_patsat_z'                                                              & `f_waldm_healthout_z'                                                          & `f_waldm_mortrate_05'         \\
	tex \multirow{2}{*}{Adjusted p-value (FT)}   & `adj_pm4'  & `adj_pm5'  & `adj_pm1'           & `adj_pm2'                                                            & `adj_pm3'                                                               & `adj_pm6'                                                          & `adj_pm7'         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	*************************************************************************
	* Table I51: Intermediate outcomes (midline) – Averaged z-score indices *
	*************************************************************************

	* In this part, we regress the intermediate outcomes over the full treatment vs control
	
	local var treatfull
	
	* At midline:
	
	eststo clear 
	
	* We work on the coefficient plot and tables for the intermediate indices
	
	* At midline:
	
	eststo clear
	
	local y = 1
	foreach x in `intermediate' {
		areg  m_`x' `var' bm_`x' bm_`x'_d `m_controls_tfull' ``var'_int_m_controls', robust cl(hc_id) a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		
		test treatfull = 0
		local f_waldm_`x' = string(`r(p)',"%9.3fc")
		
		estadd scalar f_waldm = `f_waldm_`x''
		
		local y = `y' + 1
		}
		
	local y = 5
	foreach x in `intermediate_hclevel' {
		areg  m_`x' `var' bm_`x' bm_`x'_d `m_controls_tfull_hc' ``var'_hc_int_m_controls' if uniquehc == 1, robust a(district)
		
		local p_`y' = (2 * ttail(e(df_r), abs(_b[`var']/_se[`var'])))
		
		estimates store m`y'
		
		test treatfull = 0
		local f_waldm_`x' = string(`r(p)',"%9.3fc")
		
		estadd scalar f_waldm = `f_waldm_`x''
		
		local y = `y' + 1
		}
	
	* We create the adjusted p-value following the Benjamini-Hochberg methodology 
	
	local y = `y' - 1
	
	local ps `p_1'
	forvalues x = 2/`y' {
		local ps `ps' \ `p_`x''
		}

	matrix mat = (`ps')
		
	* We need to rank the p-value, transpose it and transfer it to local
	
	matsort mat 1 "up"
	
	mat ps_mat = mat'
	
	mat list ps_mat
	
	local ps_rank
	
	forvalues z = 1/`y' {
		local x = ps_mat[1,`z']
		local ps_rank `ps_rank' `x'
		}
		
	di "`ps_rank'"
	
	* We count the number of tests (numerator)
	
	local num_p = `y'
	
	* We calculate the BH value
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		local adj_p`z' = (`i' * `num_p') / `z'
		}
		
	* We compare it according to the rank and eventually replace it
	
	forvalues r = 1/`y' {
	local d = `y' - 1
	forvalues z = 1/`d' {
		local v = `z' + 1
			if `adj_p`z'' >= `adj_p`v'' {
				local adj_p`z' `adj_p`v''
				}
			}
			}
	
	* We store it in the estimator
	
	local z = 0
	foreach i of local ps_rank {
		local z = `z' + 1 
		forvalues j = 1/`y' {
			if `i' == `p_`j'' { 
			estimates restore m`j'
			estadd scalar adj_p = `adj_p`z''
			}
		}
		}	
		

	# delimit;
	
	esttab m1 m5 m2 m3 m4 m6
	using "${tables}/TableI51.tex", b(%5.3f) se(%5.3f)
		title(Intermediate outcomes (midline) -- Averaged z-score indices)
		keep(`var' _cons)
		varlabels (`var' "Full treatment" _cons "Constant")	
		starlevels(* .10 ** .05 *** .01) 		
		mtitles("\textbf{\begin{tabular}[c]{@{}c@{}}Citizen\\knowledge\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}HC staff\\knowledge\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Efficacy\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Community\\responsibility\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}Relationship\end{tabular}}"
				"\textbf{\begin{tabular}[c]{@{}c@{}}HC\\transparency\end{tabular}}")
		stats(N r2 f_waldm adj_p, labels("N" "R$^{2}$" "P-value (Full treatment = 0)" "Adjusted p-value (FT)") fmt(%9.0fc %9.3fc)) label booktabs nonotes replace
	
	;
	
	# delimit cr
	
	**********************************************************
	* Table I52: Robustness checks – Main outcomes (midline) *
	**********************************************************
	
	* At midline
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* In this part, we regress the outcomes over the full treatment vs control
	
	local indices urate_z treatqual_z treatqualalt_z patsat_z commtg_z
	
	local indices_hc mortrate_05 h_ctzpressure_z
	
	* At midline:
	
	**************
	* No control *
	**************
	
	eststo clear
	
	local var treatfull

	foreach x in `indices' {
		areg  m_`x' `var' bm_`x' bm_`x'_d, robust cl(hc_id) a(district)
		local n_nocon_`x' = string(`e(N)',"%9.0fc")
		local b_nocon_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocon_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocon_`x' =string(_se[_cons],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local csb_nocon_`x' `csb_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local csb_nocon_`x' `csb_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local csb_nocon_`x' `csb_nocon_`x''***
		}
		
		}
		
	* We do it for hc level variable
	
	foreach x in `indices_hc' {
		areg  m_`x' `var' bm_`x' if uniquehc == 1, robust a(district)
		local n_nocon_`x' = string(`e(N)',"%9.0fc")
		local b_nocon_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocon_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocon_`x' =string(_se[_cons],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local csb_nocon_`x' `csb_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local csb_nocon_`x' `csb_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local csb_nocon_`x' `csb_nocon_`x''***
		}
		
		}
	
	*********
	* No FE *
	*********
	
	* We define the control variable
	
	local  m_controls_noprefix hc2 b_h_del b_h_staff_houses bm_visited_d bm_educyr bm_assetindex
		
	foreach x in m_ {
	
		local `x'controls_tfull
		local `x'controls_tfull_hc
		
		}
		
	foreach x in m_ {
		foreach var in treatfull {
			local `var'_int_`x'controls
			local `var'_hc_int_`x'controls
			}
		}
		
	* We populate the control variable we just created
		
	foreach var of local m_controls_noprefix {
		local m_controls_tfull `m_controls_tfull' c_tfull_`var'
		local m_controls_tfull_hc `m_controls_tfull_hc' c_tfull_hc_`var'
		}	
				
	foreach treat in treatfull {
		foreach var of local m_controls_noprefix {
			local `treat'_int_m_controls ``treat'_int_m_controls' c_`treat'_`var'
			local `treat'_hc_int_m_controls ``treat'_hc_int_m_controls' c_`treat'_hc_`var'
			}
		}
	
	
	eststo clear
	
	local var treatfull
	
	foreach x in `indices' {
		reg  m_`x' `var' bm_`x' bm_`x'_d `m_controls_tfull' ``var'_int_m_controls', cl(hc_id) robust
		local n_nofe_`x' = string(`e(N)',"%9.0fc")
		local b_nofe_`x' = string(_b[treatfull],"%9.3fc")
		local se_nofe_`x' =string(_se[treatfull],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = string(_b[_cons],"%9.3fc")
		local csse_nofe_`x' =string(_se[_cons],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local csb_nofe_`x' `csb_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local csb_nofe_`x' `csb_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local csb_nofe_`x' `csb_nofe_`x''***
		}
		
		}
		
	* We include the hc level child mortality
	
	foreach x in `indices_hc' {
		reg  m_`x' `var' bm_`x' `m_controls_tfull_hc' ``var'_hc_int_m_controls' if uniquehc == 1, robust
		local n_nofe_`x' = string(`e(N)',"%9.0fc")
		local b_nofe_`x' = string(_b[treatfull],"%9.3fc")
		local se_nofe_`x' =string(_se[treatfull],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = string(_b[_cons],"%9.3fc")
		local csse_nofe_`x' =string(_se[_cons],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local csb_nofe_`x' `csb_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local csb_nofe_`x' `csb_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local csb_nofe_`x' `csb_nofe_`x''***
		}
		
		}
		
	*************************
	* Agregated at HC level *
	*************************
	
	local indices_hc mortrate_05 h_ctzpressure_z
	
	* Our first step is to create the mean at HC level
	
	foreach x of local indices {
		byso hc_id : egen mean_m_`x' = mean(m_`x')
		byso hc_id : egen mean_bm_`x' = mean(bm_`x')
		byso hc_id : egen mean_bm_`x'_d = mean(bm_`x'_d)
		}
		
	foreach x of local indices_hc {
		byso hc_id : egen mean_m_`x' = mean(m_`x')
		byso hc_id : egen mean_bm_`x' = mean(bm_`x')
		}
	
	
	eststo clear
	
	local var treatfull
	
	foreach x in `indices' {
		areg  mean_m_`x' `var' mean_bm_`x' mean_bm_`x'_d `m_controls_tfull_hc' ``var'_hc_int_m_controls' if uniquehc == 1, robust a(district)
		local n_mean_`x' = string(`e(N)',"%9.0fc")
		local b_mean_`x' = string(_b[treatfull],"%9.3fc")
		local se_mean_`x' =string(_se[treatfull],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local b_mean_`x' `b_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local b_mean_`x' `b_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local b_mean_`x' `b_mean_`x''***
		}
		
		local csb_mean_`x' = string(_b[_cons],"%9.3fc")
		local csse_mean_`x' =string(_se[_cons],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local csb_mean_`x' `csb_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local csb_mean_`x' `csb_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local csb_mean_`x' `csb_mean_`x''***
		}
		
		}

	eststo clear
			
	foreach x in `indices_hc' {
		areg  mean_m_`x' `var' mean_bm_`x' `m_controls_tfull_hc' ``var'_hc_int_m_controls' if uniquehc == 1, robust a(district)
		local n_mean_`x' = string(`e(N)',"%9.0fc")
		local b_mean_`x' = string(_b[treatfull],"%9.3fc")
		local se_mean_`x' =string(_se[treatfull],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local b_mean_`x' `b_mean_`x''*
		}                             
		
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local b_mean_`x' `b_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local b_mean_`x' `b_mean_`x''***
		}
		
		local csb_mean_`x' = string(_b[_cons],"%9.3fc")
		local csse_mean_`x' =string(_se[_cons],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local csb_mean_`x' `csb_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local csb_mean_`x' `csb_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local csb_mean_`x' `csb_mean_`x''***
		}
		
		}
		
	***********************************
	* Diff in Diff midline - baseline *
	***********************************
	
	local add_control
	
	foreach var of local indices {
		local add_control `add_control' bm_`var'_d
		}
	
	local var treatfull
	
	local m_indices m_urate_z m_treatqual_z m_treatqualalt_z m_patsat_z m_commtg_z
	local m_indices_hc m_mortrate_05 m_h_ctzpressure_z
	
	local bm_indices bm_urate_z bm_treatqual_z bm_treatqualalt_z bm_patsat_z bm_commtg_z
	local bm_indices_hc bm_mortrate_05 bm_h_ctzpressure_z
	
	keep hh_id hc_id `add_control' `bm_indices' `bm_indices_hc' `m_indices' `m_indices_hc' `m_controls_tfull' `m_controls_tfull_hc' ``var'_int_m_controls' ``var'_hc_int_m_controls' district uniquehc treatfull midline_presence
	
	foreach x of local indices {
		ren bm_`x' `x'_bm
		ren m_`x' `x'_m
		}
		
	foreach x of local indices_hc {
		ren bm_`x' `x'_bm
		ren m_`x' `x'_m
		}
		
	reshape long `indices' `indices_hc' , i(hh_id) j(num) s
	
	gen y15 = (num == "_m")
	
	drop num
	
	gen t_15 = treatfull*y15
	
	local indices urate_z treatqual_z treatqualalt_z patsat_z commtg_z
	local indices_hc mortrate_05 h_ctzpressure_z
	
	foreach x in `indices' {
		areg `x' t_15 y15 bm_`x'_d `m_controls_tfull' ``var'_int_m_controls' if midline_presence == 1, robust cl(hc_id) a(district)
		local n_dd_`x' = string(`e(N)',"%9.0fc")
		local b_dd_`x' = string(_b[t_15],"%9.3fc")
		local se_dd_`x' =string(_se[t_15],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[t_15]/_se[t_15])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local b_dd_`x' `b_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local b_dd_`x' `b_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local b_dd_`x' `b_dd_`x''***
		}
		
		local csb_dd_`x' = string(_b[_cons],"%9.3fc")
		local csse_dd_`x' =string(_se[_cons],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local csb_dd_`x' `csb_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local csb_dd_`x' `csb_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local csb_dd_`x' `csb_dd_`x''***
		}
		
		}
		
	eststo clear
	
	foreach x in `indices_hc' {
		areg `x' t_15 y15 `m_controls_tfull_hc' ``var'_hc_int_m_controls' if uniquehc == 1, robust a(district)
		local n_dd_`x' = string(`e(N)',"%9.0fc")
		local b_dd_`x' = string(_b[t_15],"%9.3fc")
		local se_dd_`x' =string(_se[t_15],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[t_15]/_se[t_15])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local b_dd_`x' `b_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local b_dd_`x' `b_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local b_dd_`x' `b_dd_`x''***
		}
		
		local csb_dd_`x' = string(_b[_cons],"%9.3fc")
		local csse_dd_`x' =string(_se[_cons],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local csb_dd_`x' `csb_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local csb_dd_`x' `csb_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local csb_dd_`x' `csb_dd_`x''***
		}
		
		}
	

	* Health outcome
	
	* We load the dataset. This is the light version
	
	use "${usedata}/healthoutcome_midline_ind.dta", clear
	
	* In this part, we regress the outcomes over the full treatment vs control
	
	local var treatfull
	
	local x healthoutcome_z
	
	* At midline:
	
	**************
	* No control *
	**************
	
	eststo clear

		areg  m_`x' `var' b_`x', robust cl(hc_id) a(district)
		local n_nocon_`x' = string(`e(N)',"%9.0fc")
		local b_nocon_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocon_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocon_`x' =string(_se[_cons],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local csb_nocon_`x' `csb_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local csb_nocon_`x' `csb_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local csb_nocon_`x' `csb_nocon_`x''***
		}
		
	
	*********
	* No FE *
	*********
	
	* We define the control variable
	
	local  m_controls_noprefix hc2 b_h_del b_h_staff_houses bm_visited_d bm_educyr bm_assetindex
		
	foreach x in m_ {
	
		local `x'controls_tfull
		
		}
		
	foreach x in m_ {
		foreach var in treatfull {
			local `var'_int_`x'controls
						}
		}
		
	foreach var of local m_controls_noprefix {
		local m_controls_tfull `m_controls_tfull' c_tfull_`var'
			}	
				
	foreach treat in treatfull {
		foreach var of local m_controls_noprefix {
			local `treat'_int_m_controls ``treat'_int_m_controls' c_`treat'_`var'
				}
		}
	
	
	local var treatfull
	
	local x healthoutcome_z
	
	eststo clear
	
		reg  m_`x' `var' b_`x' `m_controls_tfull' ``var'_int_m_controls', cl(hc_id) robust
		local n_nofe_`x' = string(`e(N)',"%9.0fc")
		local b_nofe_`x' = string(_b[treatfull],"%9.3fc")
		local se_nofe_`x' =string(_se[treatfull],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = string(_b[_cons],"%9.3fc")
		local csse_nofe_`x' =string(_se[_cons],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local csb_nofe_`x' `csb_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local csb_nofe_`x' `csb_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local csb_nofe_`x' `csb_nofe_`x''***
		}
		
		
	*************************
	* Agregated at HC level *
	*************************
	
	preserve
	
	* Our first step is to create the mean at HC level
	
	byso hc_id : egen tmean_m_`x' = mean(m_`x') 
	byso hc_id : egen mean_m_`x' = max(tmean_m_`x')
	
	byso hc_id : egen tmean_b_`x' = mean(b_`x')
	byso hc_id : egen mean_b_`x' = max(tmean_b_`x')
	
	drop tmean_*
	
	* We create unique hh as we are at child level
	
	byso hh_id: gen count = _n
	
	* We need to do the same at hc level
	
	local controls hc2 b_h_del b_h_staff_houses bm_visited_d bm_educyr bm_assetindex
	
	* We will remove the mean from the control variable
	
	* Full treatment (we don't need to create a midline presence as we only have household with children)

	foreach var of local controls {
		byso hc_id: egen temp_mean_`var' = mean(`var') if treatfull != . & count == 1
		byso hc_id: egen t_mean_`var' = max(temp_mean_`var') if treatfull != .
		qui sum t_mean_`var' if treatfull != . & uniquehc == 1
		gen c_tfull_hc_`var' = t_mean_`var' - `r(mean)'
		lab var c_tfull_hc_`var' "Control variable of `var' minus its mean in the full treatment at hc level"
		drop t_mean_`var' temp_mean_`var'
		}
		
	drop count
	
	* Full treatment
	
	foreach x of local controls {
			gen c_treatfull_hc_`x' = treatfull * c_tfull_hc_`x'
			lab var c_treatfull_hc_`x' "Interaction term of contral variable `x' with treatment at hc level"
			}
			
	* We take care of duplicates 
	
	duplicates drop hh_id uniquehc, force
	
	drop uniquehc 
	
	egen uniquehc = tag(hc_id) if midline_presence == 1
	recode uniquehc(.=0)
	lab var uniquehc "Unique HC"
	
	* We local the variable
	
	foreach x in m_ {
	
		local `x'controls_tfull_hc
		
		}
		
	foreach x in m_ {
		foreach var in treatfull {
			local `var'_hc_int_`x'controls
			}
		}
		
	foreach var of local m_controls_noprefix {
		local m_controls_tfull_hc `m_controls_tfull_hc' c_tfull_hc_`var'
		}	
				
	foreach treat in treatfull {
		foreach var of local m_controls_noprefix {
			local `treat'_hc_int_m_controls ``treat'_hc_int_m_controls' c_`treat'_hc_`var'
			}
		}
	
	local var treatfull
	
	local x healthoutcome_z
	
	eststo clear
	
		areg  mean_m_`x' `var' mean_b_`x' `m_controls_tfull_hc' ``var'_hc_int_m_controls' if uniquehc == 1, robust a(district)
		local n_mean_`x' = string(`e(N)',"%9.0fc")
		local b_mean_`x' = string(_b[treatfull],"%9.3fc")
		local se_mean_`x' =string(_se[treatfull],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local b_mean_`x' `b_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local b_mean_`x' `b_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local b_mean_`x' `b_mean_`x''***
		}
		
		local csb_mean_`x' = string(_b[_cons],"%9.3fc")
		local csse_mean_`x' =string(_se[_cons],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local csb_mean_`x' `csb_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local csb_mean_`x' `csb_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local csb_mean_`x' `csb_mean_`x''***
		}
	
	restore
	
	***********************************
	* Diff in Diff midline - baseline *
	***********************************

	local var treatfull
	
	local x healthoutcome_z
	
	keep hh_id hc_id m_healthoutcome_z b_healthoutcome_z `m_controls_tfull' ``var'_int_m_controls'  district uniquehc treatfull midline_presence
	
	gen nomeasure_midline = (b_healthoutcome_z == . | m_healthoutcome_z == .)
	replace nomeasure_midline = 1 if midline_presence == 0
	
	ren b_`x' `x'_b
	ren m_`x' `x'_m
	
	* Creating a new id to reshape
	
	byso hh_id: gen temp = _n
	
	tostring hh_id temp, replace
	
	replace hh_id = hh_id + temp
	
	destring hh_id, replace
	
	drop temp
	
	* Reshape
	
	reshape long healthoutcome_z , i(hh_id) j(num) s
	
	gen y15 = (num == "_m")
	
	drop num
	
	gen t_15 = treatfull*y15
	
		areg `x' t_15 y15 `m_controls_tfull' ``var'_int_m_controls' if midline_presence == 1, robust cl(hc_id) a(district)
		local n_dd_`x' = string(`e(N)',"%9.0fc")
		local b_dd_`x' = string(_b[t_15],"%9.3fc")
		local se_dd_`x' =string(_se[t_15],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[t_15]/_se[t_15])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local b_dd_`x' `b_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local b_dd_`x' `b_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local b_dd_`x' `b_dd_`x''***
		}
		
		local csb_dd_`x' = string(_b[_cons],"%9.3fc")
		local csse_dd_`x' =string(_se[_cons],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local csb_dd_`x' `csb_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local csb_dd_`x' `csb_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local csb_dd_`x' `csb_dd_`x''***
		}
	
	* We outsheet results with child mortality HC level indicators
	
	texdoc init "${tables}/TableI52.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \small
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Robustness checks -- Main outcomes (midline)}
	tex \begin{tabular}{lggggggg}
	tex \toprule
	tex 											  & (1)                       & (2)                                                          & (3)                                                             & (4)                                                        & (5) & (6) & (7)                        \\
    tex                              & \textbf{\begin{tabular}[c]{@{}c@{}}Citizen \\ monitoring\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Perceived \\ citizen \\ pressure\end{tabular}} & \textbf{Utilization}      & \textbf{\begin{tabular}[c]{@{}c@{}}Treatment \\ quality\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Patient \\ satisfaction\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Health \\ outcomes\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Child \\ mortality\end{tabular}}        \\
	tex \midrule
	tex \textit{A: Without control variables} \\
	tex \multirow{2}{*}{Program impact}  &`b_nocon_commtg_z' &`b_nocon_h_ctzpressure_z' &`b_nocon_urate_z'           & `b_nocon_treatqual_z'                                                            & `b_nocon_patsat_z'                                                               & `b_nocon_healthoutcome_z'                                                          & `b_nocon_mortrate_05'         \\
	tex  & (`se_nocon_commtg_z') & (`se_nocon_h_ctzpressure_z') & (`se_nocon_urate_z')           & (`se_nocon_treatqual_z')                                                            & (`se_nocon_patsat_z')                                                               & (`se_nocon_healthoutcome_z')                                                          & (`se_nocon_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}   &`csb_nocon_commtg_z' &`csb_nocon_h_ctzpressure_z' &`csb_nocon_urate_z'           & `csb_nocon_treatqual_z'                                                            & `csb_nocon_patsat_z'                                                               & `csb_nocon_healthoutcome_z'                                                          & `csb_nocon_mortrate_05'         \\
	tex  & (`csse_nocon_commtg_z') & (`csse_nocon_h_ctzpressure_z') & (`csse_nocon_urate_z')           & (`csse_nocon_treatqual_z')                                                            & (`csse_nocon_patsat_z')                                                               & (`csse_nocon_healthoutcome_z')                                                          & `csse_nocon_mortrate_05'         \\
	tex \\
	tex \textit{B: Without district fixed effects} \\
	tex \multirow{2}{*}{Program impact}  &`b_nofe_commtg_z' &`b_nofe_h_ctzpressure_z' &`b_nofe_urate_z'           & `b_nofe_treatqual_z'                                                            & `b_nofe_patsat_z'                                                               & `b_nofe_healthoutcome_z'                                                          & `b_nofe_mortrate_05'         \\
	tex  & (`se_nofe_commtg_z') & (`se_nofe_h_ctzpressure_z') & (`se_nofe_urate_z')           & (`se_nofe_treatqual_z')                                                            & (`se_nofe_patsat_z')                                                               & (`se_nofe_healthoutcome_z')                                                          & (`se_nofe_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}   &`csb_nofe_commtg_z' &`csb_nofe_h_ctzpressure_z' &`csb_nofe_urate_z'           & `csb_nofe_treatqual_z'                                                            & `csb_nofe_patsat_z'                                                               & `csb_nofe_healthoutcome_z'                                                          & `csb_nofe_mortrate_05'         \\
	tex  & (`csse_nofe_commtg_z') & (`csse_nofe_h_ctzpressure_z') & (`csse_nofe_urate_z')           & (`csse_nofe_treatqual_z')                                                            & (`csse_nofe_patsat_z')                                                               & (`csse_nofe_healthoutcome_z')                                                          & `csse_nofe_mortrate_05'         \\
	tex \\ 
	tex \textit{C: With outcome measures aggregated at HC level} \\
	tex \multirow{2}{*}{Program impact}   &`b_mean_commtg_z' &`b_mean_h_ctzpressure_z' &`b_mean_urate_z'           & `b_mean_treatqual_z'                                                            & `b_mean_patsat_z'                                                               & `b_mean_healthoutcome_z'                                                          & `b_mean_mortrate_05'         \\
	tex  & (`se_mean_commtg_z') & (`se_mean_h_ctzpressure_z') & (`se_mean_urate_z')           & (`se_mean_treatqual_z')                                                            & (`se_mean_patsat_z')                                                               & (`se_mean_healthoutcome_z')                                                          & (`se_mean_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}   &`csb_mean_commtg_z' &`csb_mean_h_ctzpressure_z' &`csb_mean_urate_z'           & `csb_mean_treatqual_z'                                                            & `csb_mean_patsat_z'                                                               & `csb_mean_healthoutcome_z'                                                          & `csb_mean_mortrate_05'         \\
	tex  &(`csse_mean_commtg_z') & (`csse_mean_h_ctzpressure_z') & (`csse_mean_urate_z')           & (`csse_mean_treatqual_z')                                                            & (`csse_mean_patsat_z')                                                               & (`csse_mean_healthoutcome_z')                                                          & (`csse_mean_mortrate_05')         \\
	tex \\ 
	tex \textit{D: Difference between post and pre-treatment values} \\
	tex \multirow{2}{*}{Program impact}   &`b_dd_commtg_z' &`b_dd_h_ctzpressure_z' &`b_dd_urate_z'           & `b_dd_treatqual_z'                                                            & `b_dd_patsat_z'                                                               & `b_dd_healthoutcome_z'                                                          & `b_dd_mortrate_05'         \\
	tex  & (`se_dd_commtg_z') & (`se_dd_h_ctzpressure_z') & (`se_dd_urate_z')           & (`se_dd_treatqual_z')                                                            & (`se_dd_patsat_z')                                                               & (`se_dd_healthoutcome_z')                                                          & (`se_dd_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}   &`csb_dd_commtg_z' &`csb_dd_h_ctzpressure_z' &`csb_dd_urate_z'           & `csb_dd_treatqual_z'                                                            & `csb_dd_patsat_z'                                                               & `csb_dd_healthoutcome_z'                                                          & `csb_dd_mortrate_05'         \\
	tex  &(`csse_dd_commtg_z') & (`csse_dd_h_ctzpressure_z') & (`csse_dd_urate_z')           & (`csse_dd_treatqual_z')                                                            & (`csse_dd_patsat_z')                                                               & (`csse_dd_healthoutcome_z')                                                          & (`csse_dd_mortrate_05')         \\
	tex \midrule
	tex Observations (A \& B)  &`n_nocon_commtg_z' &`n_nocon_h_ctzpressure_z' &`n_nocon_urate_z'           & `n_nocon_treatqual_z'                                                            & `n_nocon_patsat_z'                                                               & `n_nocon_healthoutcome_z'                                                          & `n_nocon_mortrate_05'         \\
	tex Observations (C) &`n_mean_commtg_z' &`n_mean_h_ctzpressure_z' & `n_mean_urate_z'           & `n_mean_treatqual_z'                                                            & `n_mean_patsat_z'                                                               & `n_mean_healthoutcome_z'                                                          & `n_mean_mortrate_05'         \\
	tex Observations (D) &`n_dd_commtg_z' &`n_dd_h_ctzpressure_z' & `n_dd_urate_z'           & `n_dd_treatqual_z'                                                            & `n_dd_patsat_z'                                                               & `n_dd_healthoutcome_z'                                                          & `n_dd_mortrate_05'         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	******************************************************************
	* Table I53: Robustness checks – Intermediate outcomes (midline) *
	******************************************************************
	
	* At midline
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* We need to compute robustness check for Main and Intermediate outcomes
	
	* No control
	* No FE
	* HC agregated level
	* Diff and diff with baseline

	**************
	* No control *
	**************
	
	local var treatfull
	
	eststo clear

	foreach x in `intermediate' {
		areg  m_`x' `var' bm_`x' bm_`x'_d, robust cl(hc_id) a(district)
		local n_nocon_`x' = `e(N)'
		local b_nocon_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocon_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocon_`x' =string(_se[_cons],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local csb_nocon_`x' `csb_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local csb_nocon_`x' `csb_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local csb_nocon_`x' `csb_nocon_`x''***
		}
		
		}
		
	eststo clear
			
	foreach x in `intermediate_hclevel' {
		areg  m_`x' `var' bm_`x' bm_`x'_d if uniquehc == 1, robust a(district)
		local n_nocon_`x' = `e(N)'
		local b_nocon_`x' = string(_b[treatfull],"%9.3fc")
		local se_nocon_`x' =string(_se[treatfull],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local b_nocon_`x' `b_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local b_nocon_`x' `b_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local b_nocon_`x' `b_nocon_`x''***
		}
		
		local csb_nocon_`x' = string(_b[_cons],"%9.3fc")
		local csse_nocon_`x' =string(_se[_cons],"%9.3fc")
		local p_nocon_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nocon_`x'' <= 0.1 & `p_nocon_`x'' > 0.05{
			local csb_nocon_`x' `csb_nocon_`x''*
		}
	
		if `p_nocon_`x'' <= 0.05 & `p_nocon_`x'' > 0.01{
			local csb_nocon_`x' `csb_nocon_`x''**
		}
		
		if `p_nocon_`x'' <= 0.01 & `p_nocon_`x'' > 0 {
			local csb_nocon_`x' `csb_nocon_`x''***
		}
		
		}
	
	*********
	* No FE *
	*********
	
	eststo clear
	
	local var treatfull

	foreach x in `intermediate' {
		reg  m_`x' `var' bm_`x' bm_`x'_d `m_controls_tfull' ``var'_int_m_controls', cl(hc_id) robust
		local n_nofe_`x' = `e(N)'
		local b_nofe_`x' = string(_b[treatfull],"%9.3fc")
		local se_nofe_`x' =string(_se[treatfull],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = string(_b[_cons],"%9.3fc")
		local csse_nofe_`x' =string(_se[_cons],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local csb_nofe_`x' `csb_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local csb_nofe_`x' `csb_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local csb_nofe_`x' `csb_nofe_`x''***
		}
		
		}
		
	eststo clear
			
	foreach x in `intermediate_hclevel' {
		reg  m_`x' `var' bm_`x' bm_`x'_d `m_controls_tfull_hc' ``var'_hc_int_m_controls' if uniquehc == 1, robust
		local n_nofe_`x' = `e(N)'
		local b_nofe_`x' = string(_b[treatfull],"%9.3fc")
		local se_nofe_`x' =string(_se[treatfull],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local b_nofe_`x' `b_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local b_nofe_`x' `b_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local b_nofe_`x' `b_nofe_`x''***
		}
		
		local csb_nofe_`x' = string(_b[_cons],"%9.3fc")
		local csse_nofe_`x' =string(_se[_cons],"%9.3fc")
		local p_nofe_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_nofe_`x'' <= 0.1 & `p_nofe_`x'' > 0.05{
			local csb_nofe_`x' `csb_nofe_`x''*
		}
	
		if `p_nofe_`x'' <= 0.05 & `p_nofe_`x'' > 0.01{
			local csb_nofe_`x' `csb_nofe_`x''**
		}
		
		if `p_nofe_`x'' <= 0.01 & `p_nofe_`x'' > 0 {
			local csb_nofe_`x' `csb_nofe_`x''***
		}
		
		}
		
	*************************
	* Agregated at HC level *
	*************************
	
	foreach x of local intermediate {
		byso hc_id : egen mean_m_`x' = mean(m_`x')
		byso hc_id : egen mean_bm_`x' = mean(bm_`x')
		byso hc_id : egen mean_bm_`x'_d = mean(bm_`x'_d)
		}
		
	* Already agregated just created for the form
	
	foreach x of local intermediate_hclevel {
		byso hc_id : egen mean_m_`x' = mean(m_`x')
		byso hc_id : egen mean_bm_`x' = mean(bm_`x')
		byso hc_id : egen mean_bm_`x'_d = mean(bm_`x'_d)
		}
	
	eststo clear
	
	local var treatfull
	
	foreach x in `intermediate' {
		areg  mean_m_`x' `var' mean_bm_`x' mean_bm_`x'_d `m_controls_tfull' ``var'_int_m_controls' if uniquehc == 1, robust a(district)
		local n_mean_`x' = `e(N)'
		local b_mean_`x' = string(_b[treatfull],"%9.3fc")
		local se_mean_`x' =string(_se[treatfull],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local b_mean_`x' `b_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local b_mean_`x' `b_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local b_mean_`x' `b_mean_`x''***
		}
		
		local csb_mean_`x' = string(_b[_cons],"%9.3fc")
		local csse_mean_`x' =string(_se[_cons],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local csb_mean_`x' `csb_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local csb_mean_`x' `csb_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local csb_mean_`x' `csb_mean_`x''***
		}
		
		}
		
	eststo clear
			
	foreach x in `intermediate_hclevel' {
		areg  mean_m_`x' `var' mean_bm_`x' mean_bm_`x'_d `m_controls_tfull_hc' ``var'_hc_int_m_controls' if uniquehc == 1, robust a(district)
		local n_mean_`x' = `e(N)'
		local b_mean_`x' = string(_b[treatfull],"%9.3fc")
		local se_mean_`x' =string(_se[treatfull],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[treatfull]/_se[treatfull])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local b_mean_`x' `b_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local b_mean_`x' `b_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local b_mean_`x' `b_mean_`x''***
		}
		
		local csb_mean_`x' = string(_b[_cons],"%9.3fc")
		local csse_mean_`x' =string(_se[_cons],"%9.3fc")
		local p_mean_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_mean_`x'' <= 0.1 & `p_mean_`x'' > 0.05{
			local csb_mean_`x' `csb_mean_`x''*
		}
	
		if `p_mean_`x'' <= 0.05 & `p_mean_`x'' > 0.01{
			local csb_mean_`x' `csb_mean_`x''**
		}
		
		if `p_mean_`x'' <= 0.01 & `p_mean_`x'' > 0 {
			local csb_mean_`x' `csb_mean_`x''***
		}
		
		}
		
	***********************************
	* Diff in Diff midline - baseline *
	***********************************
	
	local add_control
		
	foreach var of local intermediate {
		local add_control `add_control' bm_`var'_d
		}
		
	foreach var of local intermediate_hclevel {
		local add_control `add_control' bm_`var'_d
		}
	
	local var treatfull
	
	local bm_intermediate bm_ctzknow_z bm_eff_z bm_commresp_z bm_relhhhc_z
	local m_intermediate m_ctzknow_z m_eff_z m_commresp_z m_relhhhc_z
	
	local bm_intermediate_hclevel bm_h_hcpknow_z bm_h_hctrans_z
	local m_intermediate_hclevel m_h_hcpknow_z m_h_hctrans_z
	
	keep hh_id hc_id `add_control' `bm_intermediate' `bm_intermediate_hclevel' `m_intermediate' `m_intermediate_hclevel' `m_controls_tfull_hc' `m_controls_tfull_hom' ``var'_hc_int_m_controls' `m_controls_tfull' ``var'_int_m_controls' `tfulli_hom_m_controls'  district uniquehc treatfull midline_presence
	
	gen nomeasure_midline = 0
	replace nomeasure_midline = 1 if midline_presence == 0
	
	
	foreach x of local intermediate {
		ren bm_`x' `x'_bm
		ren m_`x' `x'_m
		}
		
	foreach x of local intermediate_hclevel {
		ren bm_`x' `x'_bm
		ren m_`x' `x'_m
		}
		
	reshape long `intermediate' `intermediate_hclevel', i(hh_id) j(num) s
	
	gen y15 = (num == "_m")
	
	drop num
	
	gen t_15 = treatfull*y15
	
	eststo clear
	
	foreach x in `intermediate' {
		areg `x' t_15 y15 bm_`x'_d `m_controls_tfull' ``var'_int_m_controls' if midline_presence == 1, robust cl(hc_id) a(district)
		local n_dd_`x' = `e(N)'
		local b_dd_`x' = string(_b[t_15],"%9.3fc")
		local se_dd_`x' =string(_se[t_15],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[t_15]/_se[t_15])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local b_dd_`x' `b_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local b_dd_`x' `b_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local b_dd_`x' `b_dd_`x''***
		}
		
		local csb_dd_`x' = string(_b[_cons],"%9.3fc")
		local csse_dd_`x' =string(_se[_cons],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local csb_dd_`x' `csb_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local csb_dd_`x' `csb_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local csb_dd_`x' `csb_dd_`x''***
		}
		
		}
		
	eststo clear
			
	foreach x in `intermediate_hclevel' {
		areg `x' t_15 y15 bm_`x'_d `m_controls_tfull_hc' ``var'_hc_int_m_controls' if uniquehc == 1, robust a(district)
		local n_dd_`x' = `e(N)'
		local b_dd_`x' = string(_b[t_15],"%9.3fc")
		local se_dd_`x' =string(_se[t_15],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[t_15]/_se[t_15])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local b_dd_`x' `b_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local b_dd_`x' `b_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local b_dd_`x' `b_dd_`x''***
		}
		
		local csb_dd_`x' = string(_b[_cons],"%9.3fc")
		local csse_dd_`x' =string(_se[_cons],"%9.3fc")
		local p_dd_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
			
		if `p_dd_`x'' <= 0.1 & `p_dd_`x'' > 0.05{
			local csb_dd_`x' `csb_dd_`x''*
		}
	
		if `p_dd_`x'' <= 0.05 & `p_dd_`x'' > 0.01{
			local csb_dd_`x' `csb_dd_`x''**
		}
		
		if `p_dd_`x'' <= 0.01 & `p_dd_`x'' > 0 {
			local csb_dd_`x' `csb_dd_`x''***
		}
		
		}
	
	texdoc init "${tables}/TableI53.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \footnotesize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Robustness checks -- Intermediate outcomes (midline)}
	tex \begin{tabular}{lggggggg}
	tex \toprule
	tex 										  & (1)                       & (2)                                                          & (3)                                                             & (4)                                                        & (5)                       & (6)                                          \\
    tex                                & \textbf{\begin{tabular}[c]{@{}c@{}}Citizen \\ knowledge\end{tabular}}      & \textbf{\begin{tabular}[c]{@{}c@{}}HC staff \\ knowledge\end{tabular}} & \textbf{Efficacy} & \textbf{\begin{tabular}[c]{@{}c@{}}Community \\ responsibility\end{tabular}}  & \textbf{Relationship} & \textbf{\begin{tabular}[c]{@{}c@{}}HC \\ transparency\end{tabular}}     \\
	tex \midrule
	tex \textit{A: Without control variables} \\
	tex \multirow{2}{*}{Program impact}   &`b_nocon_ctzknow_z'           & `b_nocon_h_hcpknow_z'                                                            & `b_nocon_eff_z'                                                               & `b_nocon_commresp_z'                                                           & `b_nocon_relhhhc_z' & `b_nocon_h_hctrans_z'         \\
	tex  & (`se_nocon_ctzknow_z')           & (`se_nocon_h_hcpknow_z')                                                            & (`se_nocon_eff_z')                                                               & (`se_nocon_commresp_z')                                                          & (`se_nocon_relhhhc_z') & (`se_nocon_h_hctrans_z')        \\
	tex \multirow{2}{*}{Constant}   &`csb_nocon_ctzknow_z'           & `csb_nocon_h_hcpknow_z'                                                            & `csb_nocon_eff_z'                                                               & `csb_nocon_commresp_z'                                                           & `csb_nocon_relhhhc_z' & `csb_nocon_h_hctrans_z'         \\
	tex  & (`csse_nocon_ctzknow_z')           & (`csse_nocon_h_hcpknow_z')                                                            & (`csse_nocon_eff_z')                                                               & (`csse_nocon_commresp_z')                                                           & (`csse_nocon_relhhhc_z') & (`csse_nocon_h_hctrans_z')        \\
	tex \\
	tex \textit{B: Without district fixed effects} \\
	tex \multirow{2}{*}{Program impact}   &`b_nofe_ctzknow_z'           & `b_nofe_h_hcpknow_z'                                                            & `b_nofe_eff_z'                                                               & `b_nofe_commresp_z'                                                          & `b_nofe_relhhhc_z' & `b_nofe_h_hctrans_z'        \\
	tex  & (`se_nofe_ctzknow_z')           & (`se_nofe_h_hcpknow_z')                                                            & (`se_nofe_eff_z')                                                               & (`se_nofe_commresp_z')                                                         & (`se_nofe_relhhhc_z') & (`se_nofe_h_hctrans_z')        \\
	tex \multirow{2}{*}{Constant}   &`csb_nofe_ctzknow_z'           & `csb_nofe_h_hcpknow_z'                                                            & `csb_nofe_eff_z'                                                               & `csb_nofe_commresp_z'                                                          & `csb_nofe_relhhhc_z' & `csb_nofe_h_hctrans_z'      \\
	tex  & (`csse_nofe_ctzknow_z')           & (`csse_nofe_h_hcpknow_z')                                                            & (`csse_nofe_eff_z')                                                               & (`csse_nofe_commresp_z')                                                            & (`csse_nofe_relhhhc_z') & (`csse_nofe_h_hctrans_z')      \\
	tex \\ 
	tex \textit{C: Without ouctome measures aggregated at HC level} \\
	tex \multirow{2}{*}{Program impact}   &`b_mean_ctzknow_z'           & `b_mean_h_hcpknow_z'                                                            & `b_mean_eff_z'                                                               & `b_mean_commresp_z'                                                          & `b_mean_relhhhc_z' & `b_mean_h_hctrans_z'        \\
	tex  & (`se_mean_ctzknow_z')           & (`se_mean_h_hcpknow_z')                                                            & (`se_mean_eff_z')                                                               & (`se_mean_commresp_z')                                                            & (`se_mean_relhhhc_z') & (`se_mean_h_hctrans_z')        \\
	tex \multirow{2}{*}{Constant}   &`csb_mean_ctzknow_z'           & `csb_mean_h_hcpknow_z'                                                            & `csb_mean_eff_z'                                                               & `csb_mean_commresp_z'                                                            & `csb_mean_relhhhc_z' & `csb_mean_h_hctrans_z'       \\
	tex  & (`csse_mean_ctzknow_z')           & (`csse_mean_h_hcpknow_z')                                                            & (`csse_mean_eff_z')                                                               & (`csse_mean_commresp_z')                                                            & (`csse_mean_relhhhc_z') & (`csse_mean_h_hctrans_z')       \\
	tex \\ 
	tex \textit{D: Difference between post and pre-treatment values} \\
	tex \multirow{2}{*}{Program impact}   &`b_dd_ctzknow_z'           & `b_dd_h_hcpknow_z'                                                            & `b_dd_eff_z'                                                               & `b_dd_commresp_z'                                                          & `b_dd_relhhhc_z' & `b_dd_h_hctrans_z'         \\
	tex  & (`se_dd_ctzknow_z')           & (`se_dd_h_hcpknow_z')                                                            & (`se_dd_eff_z')                                                               & (`se_dd_commresp_z')                                                          & (`se_dd_relhhhc_z') & (`se_dd_h_hctrans_z')          \\
	tex \multirow{2}{*}{Constant}   &`csb_dd_ctzknow_z'           & `csb_dd_h_hcpknow_z'                                                            & `csb_dd_eff_z'                                                               & `csb_dd_commresp_z'                                                          & `csb_dd_relhhhc_z' & `csb_dd_h_hctrans_z'         \\
	tex  & (`csse_dd_ctzknow_z')           & (`csse_dd_h_hcpknow_z')                                                            & (`csse_dd_eff_z')                                                               & (`csse_dd_commresp_z')                                                           & (`csse_dd_relhhhc_z') & (`csse_dd_h_hctrans_z')         \\
	tex \midrule
	tex Observations (A \& B)  &`n_nocon_ctzknow_z'           & `n_nocon_h_hcpknow_z'                                                            & `n_nocon_eff_z'                                                               & `n_nocon_commresp_z'                                                          & `n_nocon_relhhhc_z' & `n_nocon_h_hctrans_z'         \\
	tex Observations (C) & `n_mean_ctzknow_z'           & `n_mean_h_hcpknow_z'                                                            & `n_mean_eff_z'                                                               & `n_mean_commresp_z'                                                           & `n_mean_relhhhc_z' & `n_mean_h_hctrans_z'         \\
	tex Observations (D) & `n_dd_ctzknow_z'           & `n_dd_h_hcpknow_z'                                                            & `n_dd_eff_z'                                                               & `n_dd_commresp_z'                                                          & `n_dd_relhhhc_z' & `n_dd_h_hctrans_z'         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	*******************************************************
	* Table I54: Main outcomes (Midline) - All treatments *
	*******************************************************
	
	* We load the dataset. This is the light version
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* At midline:
	
	eststo clear
	
	* We regress our main indices
	
	local y = 1
	foreach x in `indices' {
		areg  m_`x' fullomn infomn intomn bm_`x' bm_`x'_d  `fullomn_int_m_controls' `m_controls' `infomn_int_m_controls' `intomn_int_m_controls', robust cl(hc_id) a(district)
		
		local n_1_`x' = string(`e(N)',"%9.0fc")
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[fullomn],"%9.3fc")
		local se_1_`x' = string(_se[fullomn],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[fullomn]/_se[fullomn])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[infomn],"%9.3fc")
		local se_2_`x' = string(_se[infomn],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[infomn]/_se[infomn])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local e_3_`x' = string(_b[intomn],"%9.3fc")
		local se_3_`x' = string(_se[intomn],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[intomn]/_se[intomn])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''***"
				}
				
		local est_4_`x' = string(_b[_cons],"%9.3fc")
		local se_4_`x' = string(_se[_cons],"%9.3fc")
		local p_4_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
	
		
		test infomn = intomn
		local f_wald_`x' = string(r(p),"%9.3fc")
		
		test infomn = fullomn
		local f_wald1_`x' = string(r(p),"%9.3fc")
		
		test intomn = fullomn
		local f_wald2_`x' = string(r(p),"%9.3fc")
		
		test fullomn infomn intomn
		local f_3_`x' = string(`r(F)',"%9.3fc")
		local f_wald3_`x' = string(`r(p)',"%9.3fc")

		drop s_*
		
		}
	
	* Child mortality at the HC level
	
	local y = 6
	foreach x in `indices_hc' {
		areg  m_`x' fullomn infomn intomn bm_`x'  `fullomn_hc_int_m_controls' `m_controls_hc' `infomn_hc_int_m_controls' `intomn_hc_int_m_controls' if uniquehc == 1, robust a(district)
		
		local n_1_`x' = string(`e(N)',"%9.0fc")
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[fullomn],"%9.3fc")
		local se_1_`x' = string(_se[fullomn],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[fullomn]/_se[fullomn])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[infomn],"%9.3fc")
		local se_2_`x' = string(_se[infomn],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[infomn]/_se[infomn])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local e_3_`x' = string(_b[intomn],"%9.3fc")
		local se_3_`x' = string(_se[intomn],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[intomn]/_se[intomn])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''***"
				}
				
		local est_4_`x' = string(_b[_cons],"%9.3fc")
		local se_4_`x' = string(_se[_cons],"%9.3fc")
		local p_4_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
	
		
		test infomn = intomn
		local f_wald_`x' = string(r(p),"%9.3fc")
		
		test infomn = fullomn
		local f_wald1_`x' = string(r(p),"%9.3fc")
		
		test intomn = fullomn
		local f_wald2_`x' = string(r(p),"%9.3fc")
		
		test fullomn infomn intomn
		local f_3_`x' = string(`r(F)',"%9.3fc")
		local f_wald3_`x' = string(`r(p)',"%9.3fc")

		drop s_*
		
		}
		
	* Ctz pressure
	
	local y = 7
	foreach x in `indices_hc_ols' {
		areg  m_`x' fullomn infomn intomn bm_`x'  `fullomn_hc_int_m_controls' `m_controls_hc' `infomn_hc_int_m_controls' `intomn_hc_int_m_controls' if uniquehc == 1, robust a(district)
		
		local n_1_`x' = string(`e(N)',"%9.0fc")
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[fullomn],"%9.3fc")
		local se_1_`x' = string(_se[fullomn],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[fullomn]/_se[fullomn])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[infomn],"%9.3fc")
		local se_2_`x' = string(_se[infomn],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[infomn]/_se[infomn])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local e_3_`x' = string(_b[intomn],"%9.3fc")
		local se_3_`x' = string(_se[intomn],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[intomn]/_se[intomn])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''***"
				}
				
		local est_4_`x' = string(_b[_cons],"%9.3fc")
		local se_4_`x' = string(_se[_cons],"%9.3fc")
		local p_4_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
	
		
		test infomn = intomn
		local f_wald_`x' = string(r(p),"%9.3fc")
		
		test infomn = fullomn
		local f_wald1_`x' = string(r(p),"%9.3fc")
		
		test intomn = fullomn
		local f_wald2_`x' = string(r(p),"%9.3fc")
		
		test fullomn infomn intomn
		local f_3_`x' = string(`r(F)',"%9.3fc")
		local f_wald3_`x' = string(`r(p)',"%9.3fc")

		drop s_*
		
		}
		
	* Health outcomes
	
	use "${usedata}/healthoutcome_midline_ind.dta", clear 
	
	local x healthout_z
	
	areg  m_healthoutcome_z fullomn infomn intomn b_healthoutcome_z b_healthoutcome_z_d  `fullomn_int_m_controls' `m_controls' `infomn_int_m_controls' `intomn_int_m_controls', robust cl(hc_id) a(district)
	
		local n_1_`x' = string(`e(N)',"%9.0fc")
		local r2_1_`x' = string(`e(r2)',"%9.3fc")
		local est_1_`x' = string(_b[fullomn],"%9.3fc")
		local se_1_`x' = string(_se[fullomn],"%9.3fc")
		local p_1_`x' = (2 * ttail(e(df_r), abs(_b[fullomn]/_se[fullomn])))
		
		gen s_1_1s_`x' = (`p_1_`x''<=0.1 & `p_1_`x''>0.05)
		gen s_1_2s_`x' = (`p_1_`x''<=0.05 & `p_1_`x''>0.01)
		gen s_1_3s_`x' = (`p_1_`x''<=0.01 & `p_1_`x''>=0)
	
		if s_1_1s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''*"
				}
				
		if s_1_2s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''**"
				}
				
		if s_1_3s_`x' == 1 {
				local est_1_`x' = "`est_1_`x''***"
				}
		
		local est_2_`x' = string(_b[infomn],"%9.3fc")
		local se_2_`x' = string(_se[infomn],"%9.3fc")
		local p_2_`x' = (2 * ttail(e(df_r), abs(_b[infomn]/_se[infomn])))
		
		gen s_2_1s_`x' = (`p_2_`x''<=0.1 & `p_2_`x''>0.05)
		gen s_2_2s_`x' = (`p_2_`x''<=0.05 & `p_2_`x''>0.01)
		gen s_2_3s_`x' = (`p_2_`x''<=0.01 & `p_2_`x''>=0)
	
		if s_2_1s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''*"
				}
				
		if s_2_2s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''**"
				}
				
		if s_2_3s_`x' == 1 {
				local est_2_`x' = "`est_2_`x''***"
				}
		
		local e_3_`x' = string(_b[intomn],"%9.3fc")
		local se_3_`x' = string(_se[intomn],"%9.3fc")
		local p_3_`x' = (2 * ttail(e(df_r), abs(_b[intomn]/_se[intomn])))
		
		gen s_3_1s_`x' = (`p_3_`x''<=0.1 & `p_3_`x''>0.05)
		gen s_3_2s_`x' = (`p_3_`x''<=0.05 & `p_3_`x''>0.01)
		gen s_3_3s_`x' = (`p_3_`x''<=0.01 & `p_3_`x''>=0)
	
		if s_3_1s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''*"
				}
				
		if s_3_2s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''**"
				}
				
		if s_3_3s_`x' == 1 {
				local e_3_`x' = "`e_3_`x''***"
				}
				
		local est_4_`x' = string(_b[_cons],"%9.3fc")
		local se_4_`x' = string(_se[_cons],"%9.3fc")
		local p_4_`x' = (2 * ttail(e(df_r), abs(_b[_cons]/_se[_cons])))
		
		gen s_4_1s_`x' = (`p_4_`x''<=0.1 & `p_4_`x''>0.05)
		gen s_4_2s_`x' = (`p_4_`x''<=0.05 & `p_4_`x''>0.01)
		gen s_4_3s_`x' = (`p_4_`x''<=0.01 & `p_4_`x''>=0)
	
		if s_4_1s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''*"
				}
				
		if s_4_2s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''**"
				}
				
		if s_4_3s_`x' == 1 {
				local est_4_`x' = "`est_4_`x''***"
				}
	
		
		test infomn = intomn
		local f_wald_`x' = string(r(p),"%9.3fc")
		
		test infomn = fullomn
		local f_wald1_`x' = string(r(p),"%9.3fc")
		
		test intomn = fullomn
		local f_wald2_`x' = string(r(p),"%9.3fc")
		
		test fullomn infomn intomn
		local f_3_`x' = string(`r(F)',"%9.3fc")
		local f_wald3_`x' = string(`r(p)',"%9.3fc")

		drop s_*
		
	* We create the tables concerning the results of the main indices with hc level
	
	texdoc init "${tables}/TableI54.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \footnotesize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Main outcomes (Midline) - All treatments}
	tex \begin{tabular}{lgggggggg}
	tex \toprule
	tex 										  & (1)                       & (2)                                                          & (3)                                                             & (4)                                                        & (5)  & (6)  & (7)                       \\
    tex \multirow{-2}{*}{}               & \textbf{\begin{tabular}[c]{@{}c@{}}Citizen \\ monitoring\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Perceived \\ citizen \\ pressure \end{tabular}}             & \textbf{Utilization}      & \textbf{\begin{tabular}[c]{@{}c@{}}Treatment \\ quality\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Patient \\ satisfaction\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Health \\ outcomes\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Child \\ mortality\end{tabular}}        \\
	tex \midrule
	tex \multirow{2}{*}{Full treatment}  & `est_1_commtg_z' & `est_1_h_ctzpressure_z' & `est_1_urate_z'           & `est_1_treatqual_z'                                                            & `est_1_patsat_z'                                                               & `est_1_healthout_z'                                                          & `est_1_mortrate_05'         \\
	tex  & (`se_1_commtg_z') & (`se_1_h_ctzpressure_z') & (`se_1_urate_z')           & (`se_1_treatqual_z')                                                            & (`se_1_patsat_z')                                                               & (`se_1_healthout_z')                                                          & (`se_1_mortrate_05')         \\
	tex \multirow{2}{*}{Information only}  & `est_2_commtg_z' & `est_2_h_ctzpressure_z' & `est_2_urate_z'           & `est_2_treatqual_z'                                                            & `est_2_patsat_z'                                                               & `est_2_healthout_z'                                                          & `est_2_mortrate_05'         \\
	tex  & (`se_2_commtg_z') & (`se_2_h_ctzpressure_z')  & (`se_2_urate_z')           & (`se_2_treatqual_z')                                                            & (`se_2_patsat_z')                                                               & (`se_2_healthout_z')                                                          & (`se_2_mortrate_05')         \\
	tex \multirow{2}{*}{Interface only}  & `e_3_commtg_z' & `e_3_h_ctzpressure_z' & `e_3_urate_z'           & `e_3_treatqual_z'                                                            & `e_3_patsat_z'                                                               & `e_3_healthout_z'                                                          & `e_3_mortrate_05'         \\
	tex  & (`se_3_commtg_z') & (`se_3_h_ctzpressure_z')  & (`se_3_urate_z')           & (`se_3_treatqual_z')                                                            & (`se_3_patsat_z')                                                               & (`se_3_healthout_z')                                                         & (`se_3_mortrate_05')         \\
	tex \multirow{2}{*}{Constant}  & `est_4_commtg_z' & `est_4_h_ctzpressure_z' & `est_4_urate_z'           & `est_4_treatqual_z'                                                            & `est_4_patsat_z'                                                               & `est_4_healthout_z'                                                          & `est_4_mortrate_05'         \\
	tex  & (`se_4_commtg_z') & (`se_4_h_ctzpressure_z')  & (`se_4_urate_z')           & (`se_4_treatqual_z')                                                            & (`se_4_patsat_z')                                                               & (`se_4_healthout_z')                                                          & (`se_4_mortrate_05')         \\
	tex \midrule
	tex \multirow{1}{*}{N} & `n_1_commtg_z' & `n_1_h_ctzpressure_z' & `n_1_urate_z'           & `n_1_treatqual_z'                                                            & `n_1_patsat_z'                                                             & `n_1_healthout_z'                                                          & `n_1_mortrate_05'         \\
	tex \multirow{1}{*}{R$^{2}$}   & `r2_1_commtg_z' & `r2_1_h_ctzpressure_z' & `r2_1_urate_z'           & `r2_1_treatqual_z'                                                           & `r2_1_patsat_z'                                                               & `r2_1_healthout_z'                                                         & `r2_1_mortrate_05'         \\
	tex \multirow{1}{*}{P-value (Information = Interface)}   & `f_wald_commtg_z' & `f_wald_h_ctzpressure_z' & `f_wald_urate_z'           & `f_wald_treatqual_z'                                                            & `f_wald_patsat_z'                                                              & `f_wald_healthout_z'                                                          & `f_wald_mortrate_05'         \\
	tex \multirow{1}{*}{P-value (Information = Full treatment)} & `f_wald1_commtg_z' & `f_wald1_h_ctzpressure_z'  & `f_wald1_urate_z'           & `f_wald1_treatqual_z'                                                            & `f_wald1_patsat_z'                                                              & `f_wald1_healthout_z'                                                          & `f_wald1_mortrate_05'         \\
	tex \multirow{1}{*}{P-value (Interface = Full treatment)}  & `f_wald2_commtg_z' & `f_wald2_h_ctzpressure_z'  & `f_wald2_urate_z'           & `f_wald2_treatqual_z'                                                            & `f_wald2_patsat_z'                                                              & `f_wald2_healthout_z'                                                          & `f_wald2_mortrate_05'         \\
	tex \midrule
	tex \multirow{1}{*}{F-test (joint significance of all 3 treatment groups)}  & `f_3_commtg_z' & `f_3_h_ctzpressure_z' & `f_3_urate_z'           & `f_3_treatqual_z'                                                            & `f_3_patsat_z'                                                              & `f_3_healthout_z'                                                          & `f_3_mortrate_05'         \\
	tex \multirow{1}{*}{P-value (joint significance of all 3 treatment groups)}   & `f_wald3_commtg_z' & `f_wald3_h_ctzpressure_z' & `f_wald3_urate_z'           & `f_wald3_treatqual_z'                                                            & `f_wald3_patsat_z'                                                              & `f_wald3_healthout_z'                                                          & `f_wald3_mortrate_05'         \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
	******************************************************************
	* Table I55: Balance Across Treatment Arms (Midline and Endline) *
	******************************************************************
	
	* We create an equivalent table at midline and endline including the last two section of the previous table.
	
	* We load the dataset. This is the light version
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* A & C Midline/Endline levels of key outcome indices 
	
	* We need to compute the different rate unstandardized
	
	* Community Monitoring
	
	egen m_commtg=rowmean(m_lc1_meetings m_lc1_meetings_hc m_find_report m_find_effort)		
	
	egen e_commtg=rowmean(e_lc1_meetings e_lc1_meetings_hc e_find_report e_find_effort)		
	
	* Citizen pressure
	
	egen m_ctzpressure=rowmean(m_h_wrong_z m_h_pressure_z)
	
	egen e_ctzpressure=rowmean(e_h_wrong_z e_h_pressure_z e_h_hw_report_z)
	
	* Utilization rate
	
	egen m_urate=rowmean(m_immunization m_visit_hf m_hf_otherpract)
	
	egen e_urate=rowmean(e_immunization e_visit_hf e_hf_otherpract)
	
	* Treatment quality
	
	egen m_treatqual=rowmean(m_use_equip m_trained m_exam_privacy m_taketest m_diagnosis_explained m_h_percentstaff_sv m_h_cleanliness m_h_meanstock)
	
	egen e_treatqual=rowmean(e_use_equip e_trained e_exam_privacy e_taketest e_diagnosis_explained e_h_percentstaff_sv e_h_cleanliness e_h_meanstock)

	* Patient satisfaction
	
	egen m_patsat=rowmean(m_qualityhc_d m_qualitycare m_politestaff m_interest_health m_stafflistening m_freeexpress m_yearb_avail)
	
	egen e_patsat=rowmean(e_qualityhc_d e_qualitycare e_politestaff e_interest_health e_stafflistening e_freeexpress e_yearb_avail)
	
	* Health outcomes
	
	egen m_healthout=rowmean(m_weight_18m m_weight_36m m_muac_18m m_muac_36m)		
	
	egen e_healthout=rowmean(e_weight_18m e_weight_36m e_muac_18m e_muac_36m)
		
	* Mortality rate
	
	gen m_mortrate= m_mortrate_05
	
	gen e_mortrate= e_mortrate_05	
	
	* We local variable
	
	local m_variable m_commtg m_ctzpressure m_urate m_treatqual m_patsat m_healthout m_mortrate
	
	local m_variable_mean
	
	local e_variable e_commtg e_ctzpressure e_urate e_treatqual e_patsat e_healthout e_mortrate
	
	local e_variable_mean
	
	foreach var of local m_variable{
		
	* We compute the mean at HC level
	
	byso hc_id : egen `var'_mean = mean(`var')
	
	local m_variable_mean `m_variable_mean' `var'_mean
	
	}
	
	foreach var of local e_variable{
		
	* We compute the mean at HC level
	
	byso hc_id : egen `var'_mean = mean(`var')
	
	local e_variable_mean `e_variable_mean' `var'_mean
	
	}

	* At midline
	
	* We keep the right variable
	
	preserve
	
	keep hc_id treatment treatfull treatinter treatinfo uniquehc `m_variable_mean'
	
	foreach var of local m_variable_mean {
	
	* Treatment group
	
	qui sum `var' if treatment == 1 & uniquehc == 1
	
	local mean_t_`var' = string(`r(mean)',"%9.2fc")
	
	* Info group
	
	qui sum `var' if treatment == 2 & uniquehc == 1
	
	local mean_inf_`var' = string(`r(mean)',"%9.2fc")
		
	* Inter group
	
	qui sum `var' if treatment == 3 & uniquehc == 1
	
	local mean_int_`var' = string(`r(mean)',"%9.2fc")
		
	* Control group
	
	qui sum `var' if treatment == 4 & uniquehc == 1
	
	local mean_c_`var' = string(`r(mean)',"%9.2fc")
	
	* Difference Treatment - Control
	
	ttest `var' if uniquehc == 1, by(treatfull)
	
	local m_diff_tc_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_tc_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_tc_`var''/`r(se)')))
	
	local p_diff_tc_`var' = string(`p_diff_tc_`var'',"%9.2fc")
	
	* Difference Info - no Info
	
	ttest `var' if uniquehc == 1, by(treatinfo)
	
	local m_diff_info_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_info_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_info_`var''/`r(se)')))
	
	local p_diff_info_`var' = string(`p_diff_info_`var'',"%9.2fc")
	
	* Difference Inter - no Inter
	
	ttest `var' if uniquehc == 1, by(treatinter)
	
	local m_diff_inter_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_inter_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_inter_`var''/`r(se)')))
	
	local p_diff_inter_`var' = string(`p_diff_inter_`var'',"%9.2fc")
	
	}
	
	restore
	
	* At endline
	
	* We keep the right variable
	
	preserve
	
	keep hc_id treatment treatfull treatinter treatinfo uniquehc `e_variable_mean'
	
	foreach var of local e_variable_mean {
	
	* Treatment group
	
	qui sum `var' if treatment == 1 & uniquehc == 1
	
	local mean_t_`var' = string(`r(mean)',"%9.2fc")
	
	* Info group
	
	qui sum `var' if treatment == 2 & uniquehc == 1
	
	local mean_inf_`var' = string(`r(mean)',"%9.2fc")
		
	* Inter group
	
	qui sum `var' if treatment == 3 & uniquehc == 1
	
	local mean_int_`var' = string(`r(mean)',"%9.2fc")
		
	* Control group
	
	qui sum `var' if treatment == 4 & uniquehc == 1
	
	local mean_c_`var' = string(`r(mean)',"%9.2fc")
	
	* Difference Treatment - Control
	
	ttest `var' if uniquehc == 1, by(treatfull)
	
	local m_diff_tc_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_tc_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_tc_`var''/`r(se)')))
	
	local p_diff_tc_`var' = string(`p_diff_tc_`var'',"%9.2fc")
	
	* Difference Info - no Info
	
	ttest `var' if uniquehc == 1, by(treatinfo)
	
	local m_diff_info_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_info_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_info_`var''/`r(se)')))
	
	local p_diff_info_`var' = string(`p_diff_info_`var'',"%9.2fc")
	
	* Difference Inter - no Inter
	
	ttest `var' if uniquehc == 1, by(treatinter)
	
	local m_diff_inter_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_inter_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_inter_`var''/`r(se)')))
	
	local p_diff_inter_`var' = string(`p_diff_inter_`var'',"%9.2fc")
	
	}
	
	restore
	
	* B & D. Midline/Endline levels of intermediate outcome indices
	
	* We need to compute the different rate unstandardized
	
	* Citizen knowledge
	
	egen m_ctzknow=rowmean(m_numrights_hh m_numresp_hh m_services_hh)	
	
	egen e_ctzknow=rowmean(e_numrights_hh e_numresp_hh e_services_hh)
		
	* Healthcare provider knowledge
	
	egen m_h_hcpknow=rowmean(m_h_numrights m_h_numresp)	
	
	egen e_h_hcpknow=rowmean(e_h_numrights e_h_numresp)
	
	* Efficacy
	
	egen m_eff=rowmean(m_power m_pressure_effort m_pressure_report m_influence m_peoplesay_gov m_peoplesay_hc)
	
	egen e_eff=rowmean(e_power e_pressure_effort e_pressure_report e_influence e_peoplesay_gov e_peoplesay_hc)
	
	* Community Responsibility
	
	egen m_commresp=rowmean(m_responsible m_commembers_resp)	
	
	egen e_commresp=rowmean(e_responsible e_commembers_resp)	
	
	* Relation HH/HC
	
	egen m_relhhhc=rowmean(m_sat_rel m_trust_hw m_h_satisfiedrel m_complain)
	
	egen e_relhhhc=rowmean(e_sat_rel e_trust_hw e_h_satisfiedrel e_complain)
	
	* HC Transparency
	
	egen m_h_hctrans=rowmean(m_h_opening_posters m_h_dutyroster m_h_sugbox m_h_infoservice m_h_infoprights)	
	
	egen e_h_hctrans=rowmean(e_h_opening_posters e_h_dutyroster e_h_sugbox e_h_infoservice e_h_infoprights)	
	
	* We create the local
	
	local m_variable m_ctzknow m_h_hcpknow m_eff m_commresp m_relhhhc m_h_hctrans
	
	local m_variable_mean
	
	foreach var of local m_variable{
		
	* We compute the mean at HC level
	
	byso hc_id : egen `var'_mean = mean(`var')
	
	local m_variable_mean `m_variable_mean' `var'_mean
	
	}
	
	local e_variable e_ctzknow e_h_hcpknow e_eff e_commresp e_relhhhc e_h_hctrans
	
	local e_variable_mean
	
	foreach var of local e_variable{
		
	* We compute the mean at HC level
	
	byso hc_id : egen `var'_mean = mean(`var')
	
	local e_variable_mean `e_variable_mean' `var'_mean
	
	}
	
	* At midline
	
	* We keep the right variable
	
	preserve
	
	keep hc_id treatment treatfull treatinter treatinfo uniquehc `m_variable_mean'
	
	foreach var of local m_variable_mean {
	
	* Treatment group
	
	qui sum `var' if treatment == 1 & uniquehc == 1
	
	local mean_t_`var' = string(`r(mean)',"%9.2fc")
	
	* Info group
	
	qui sum `var' if treatment == 2 & uniquehc == 1
	
	local mean_inf_`var' = string(`r(mean)',"%9.2fc")
		
	* Inter group
	
	qui sum `var' if treatment == 3 & uniquehc == 1
	
	local mean_int_`var' = string(`r(mean)',"%9.2fc")
		
	* Control group
	
	qui sum `var' if treatment == 4 & uniquehc == 1
	
	local mean_c_`var' = string(`r(mean)',"%9.2fc")
	
	* Difference Treatment - Control
	
	ttest `var' if uniquehc == 1, by(treatfull)
	
	local m_diff_tc_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_tc_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_tc_`var''/`r(se)')))
	
	local p_diff_tc_`var' = string(`p_diff_tc_`var'',"%9.2fc")
	
	* Difference Info - no Info
	
	ttest `var' if uniquehc == 1, by(treatinfo)
	
	local m_diff_info_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_info_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_info_`var''/`r(se)')))
	
	local p_diff_info_`var' = string(`p_diff_info_`var'',"%9.2fc")
	
	* Difference Inter - no Inter
	
	ttest `var' if uniquehc == 1, by(treatinter)
	
	local m_diff_inter_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_inter_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_inter_`var''/`r(se)')))
	
	local p_diff_inter_`var' = string(`p_diff_inter_`var'',"%9.2fc")
	
	}
	
	restore
	
	* At endline
	
	* We keep the right variable
	
	preserve
	
	keep hc_id treatment treatfull treatinter treatinfo uniquehc `e_variable_mean'
	
	foreach var of local e_variable_mean {
	
	* Treatment group
	
	qui sum `var' if treatment == 1 & uniquehc == 1
	
	local mean_t_`var' = string(`r(mean)',"%9.2fc")
	
	* Info group
	
	qui sum `var' if treatment == 2 & uniquehc == 1
	
	local mean_inf_`var' = string(`r(mean)',"%9.2fc")
		
	* Inter group
	
	qui sum `var' if treatment == 3 & uniquehc == 1
	
	local mean_int_`var' = string(`r(mean)',"%9.2fc")
		
	* Control group
	
	qui sum `var' if treatment == 4 & uniquehc == 1
	
	local mean_c_`var' = string(`r(mean)',"%9.2fc")
	
	* Difference Treatment - Control
	
	ttest `var' if uniquehc == 1, by(treatfull)
	
	local m_diff_tc_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_tc_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_tc_`var''/`r(se)')))
	
	local p_diff_tc_`var' = string(`p_diff_tc_`var'',"%9.2fc")
	
	* Difference Info - no Info
	
	ttest `var' if uniquehc == 1, by(treatinfo)
	
	local m_diff_info_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_info_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_info_`var''/`r(se)')))
	
	local p_diff_info_`var' = string(`p_diff_info_`var'',"%9.2fc")
	
	* Difference Inter - no Inter
	
	ttest `var' if uniquehc == 1, by(treatinter)
	
	local m_diff_inter_`var' = `r(mu_1)' - `r(mu_2)'
	
	local p_diff_inter_`var' = (2 * ttail(`r(df_t)', abs(`m_diff_inter_`var''/`r(se)')))
	
	local p_diff_inter_`var' = string(`p_diff_inter_`var'',"%9.2fc")
	
	}
	
	restore
	
	* At midline, we calculate the number of HC
	
	count if uniquehc == 1 & treatment == 1 
	local m_n_t `r(N)'
	
	count if uniquehc == 1 & treatment == 2 
	local m_n_inf `r(N)'
	
	count if uniquehc == 1 & treatment == 3 
	local m_n_int `r(N)'
	
	count if uniquehc == 1 & treatment == 4 
	local m_n_c `r(N)'
	
	* At endline, we calculate the number of HC
	
	count if uniquehc == 1 & treatment == 1 
	local e_n_t `r(N)'
	
	count if uniquehc == 1 & treatment == 2 
	local e_n_inf `r(N)'
	
	count if uniquehc == 1 & treatment == 3 
	local e_n_int `r(N)'
	
	count if uniquehc == 1 & treatment == 4 
	local e_n_c `r(N)'
	
	* Table
	
	texdoc init "${tables}/TableI55.tex", replace force
	tex \begin{table}[htbp]\centering
	tex \scriptsize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{Balance Across Treatment Arms (Midline and Endline)}
	tex \begin{tabular}{lccccccccc}
	tex \toprule
    tex                &\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\multicolumn{1}{c}{(3)}&\multicolumn{1}{c}{(4)}&\multicolumn{1}{c}{(5)}&\multicolumn{1}{c}{(6)}&\multicolumn{1}{c}{(7)}\\
    tex               &\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Full\\treatment\end{tabular}}&\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Information\\only\end{tabular}}&\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Interface\\only\end{tabular}}&\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}Control\end{tabular}}&\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}P-value difference \\ (1) - (4)\end{tabular}}&\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}P-value difference \\ (1) \& (2) - (3) \& (4)\end{tabular}}&\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}P-value difference \\ (1) \& (3) - (2) \& (4)\end{tabular}}\\
	tex \midrule
	tex \textit{A. Midline levels of main outcome indices} & & & & & & & & \\
	tex \midrule
	tex Citizen monitoring      &  `mean_t_m_commtg_mean' & `mean_inf_m_commtg_mean'   & `mean_int_m_commtg_mean' &  `mean_c_m_commtg_mean'   &  `p_diff_tc_m_commtg_mean' & `p_diff_info_m_commtg_mean'   &  `p_diff_inter_m_commtg_mean'   \\
	tex Perceived citizen pressure      &  `mean_t_m_ctzpressure_mean' & `mean_inf_m_ctzpressure_mean'   & `mean_int_m_ctzpressure_mean' &  `mean_c_m_ctzpressure_mean'   &  `p_diff_tc_m_ctzpressure_mean' & `p_diff_info_m_ctzpressure_mean'   &  `p_diff_inter_m_ctzpressure_mean'   \\
	tex Utilization     &  `mean_t_m_urate_mean' & `mean_inf_m_urate_mean'   & `mean_int_m_urate_mean' &  `mean_c_m_urate_mean'   &  `p_diff_tc_m_urate_mean' & `p_diff_info_m_urate_mean'   &  `p_diff_inter_m_urate_mean'   \\
    tex Treatment quality      &  `mean_t_m_treatqual_mean' & `mean_inf_m_treatqual_mean'   & `mean_int_m_treatqual_mean' &  `mean_c_m_treatqual_mean'   &  `p_diff_tc_m_treatqual_mean' & `p_diff_info_m_treatqual_mean'   &  `p_diff_inter_m_treatqual_mean'   \\
    tex Patient satisfaction      &  `mean_t_m_patsat_mean' & `mean_inf_m_patsat_mean'   & `mean_int_m_patsat_mean' &  `mean_c_m_patsat_mean'   &  `p_diff_tc_m_patsat_mean' & `p_diff_info_m_patsat_mean'   &  `p_diff_inter_m_patsat_mean'   \\
    tex Health outcomes      &  `mean_t_m_healthout_mean' & `mean_inf_m_healthout_mean'   & `mean_int_m_healthout_mean' &  `mean_c_m_healthout_mean'   &  `p_diff_tc_m_healthout_mean' & `p_diff_info_m_healthout_mean'   &  `p_diff_inter_m_healthout_mean'   \\
    tex Mortality      &  `mean_t_m_mortrate_mean' & `mean_inf_m_mortrate_mean'   & `mean_int_m_mortrate_mean' &  `mean_c_m_mortrate_mean'   &  `p_diff_tc_m_mortrate_mean' & `p_diff_info_m_mortrate_mean'   &  `p_diff_inter_m_mortrate_mean'   \\
    tex \midrule
	tex \textit{B. Midline levels of intermediate outcome indices} & & & & & & & & \\
	tex \midrule
	tex Citizen knowledge      &  `mean_t_m_ctzknow_mean' & `mean_inf_m_ctzknow_mean'   & `mean_int_m_ctzknow_mean' &  `mean_c_m_ctzknow_mean'   &  `p_diff_tc_m_ctzknow_mean' & `p_diff_info_m_ctzknow_mean'   &  `p_diff_inter_m_ctzknow_mean'   \\
	tex Health worker knowledge      &  `mean_t_m_h_hcpknow_mean' & `mean_inf_m_h_hcpknow_mean'   & `mean_int_m_h_hcpknow_mean' &  `mean_c_m_h_hcpknow_mean'   &  `p_diff_tc_m_h_hcpknow_mean' & `p_diff_info_m_h_hcpknow_mean'   &  `p_diff_inter_m_h_hcpknow_mean'   \\
	tex Efficacy      &  `mean_t_m_eff_mean' & `mean_inf_m_eff_mean'   & `mean_int_m_eff_mean' &  `mean_c_m_eff_mean'   &  `p_diff_tc_m_eff_mean' & `p_diff_info_m_eff_mean'   &  `p_diff_inter_m_eff_mean'   \\
	tex Community responsibility      &  `mean_t_m_commresp_mean' & `mean_inf_m_commresp_mean'   & `mean_int_m_commresp_mean' &  `mean_c_m_commresp_mean'   &  `p_diff_tc_m_commresp_mean' & `p_diff_info_m_commresp_mean'   &  `p_diff_inter_m_commresp_mean'   \\
	tex Relationship between health workers and community    &  `mean_t_m_relhhhc_mean' & `mean_inf_m_relhhhc_mean'   & `mean_int_m_relhhhc_mean' &  `mean_c_m_relhhhc_mean'   &  `p_diff_tc_m_relhhhc_mean' & `p_diff_info_m_relhhhc_mean'   &  `p_diff_inter_m_relhhhc_mean'   \\
	tex Health center transparency      &  `mean_t_m_h_hctrans_mean' & `mean_inf_m_h_hctrans_mean'   & `mean_int_m_h_hctrans_mean' &  `mean_c_m_h_hctrans_mean'   &  `p_diff_tc_m_h_hctrans_mean' & `p_diff_info_m_h_hctrans_mean'   &  `p_diff_inter_m_h_hctrans_mean'   \\
	tex \midrule
	tex \textit{C. Endline levels of main outcome indices} & & & & & & & & \\
	tex \midrule
	tex Citizen monitoring      &  `mean_t_e_commtg_mean' & `mean_inf_e_commtg_mean'   & `mean_int_e_commtg_mean' &  `mean_c_e_commtg_mean'   &  `p_diff_tc_e_commtg_mean' & `p_diff_info_e_commtg_mean'   &  `p_diff_inter_e_commtg_mean'   \\
	tex Perceived citizen pressure      &  `mean_t_e_ctzpressure_mean' & `mean_inf_e_ctzpressure_mean'   & `mean_int_e_ctzpressure_mean' &  `mean_c_e_ctzpressure_mean'   &  `p_diff_tc_e_ctzpressure_mean' & `p_diff_info_e_ctzpressure_mean'   &  `p_diff_inter_e_ctzpressure_mean'   \\
	tex Utilization     &  `mean_t_e_urate_mean' & `mean_inf_e_urate_mean'   & `mean_int_e_urate_mean' &  `mean_c_e_urate_mean'   &  `p_diff_tc_e_urate_mean' & `p_diff_info_e_urate_mean'   &  `p_diff_inter_e_urate_mean'   \\
    tex Treatment quality      &  `mean_t_e_treatqual_mean' & `mean_inf_e_treatqual_mean'   & `mean_int_e_treatqual_mean' &  `mean_c_e_treatqual_mean'   &  `p_diff_tc_e_treatqual_mean' & `p_diff_info_e_treatqual_mean'   &  `p_diff_inter_e_treatqual_mean'   \\
    tex Patient satisfaction      &  `mean_t_e_patsat_mean' & `mean_inf_e_patsat_mean'   & `mean_int_e_patsat_mean' &  `mean_c_e_patsat_mean'   &  `p_diff_tc_e_patsat_mean' & `p_diff_info_e_patsat_mean'   &  `p_diff_inter_e_patsat_mean'   \\
    tex Health outcomes      &  `mean_t_e_healthout_mean' & `mean_inf_e_healthout_mean'   & `mean_int_e_healthout_mean' &  `mean_c_e_healthout_mean'   &  `p_diff_tc_e_healthout_mean' & `p_diff_info_e_healthout_mean'   &  `p_diff_inter_e_healthout_mean'   \\
    tex Mortality      &  `mean_t_e_mortrate_mean' & `mean_inf_e_mortrate_mean'   & `mean_int_e_mortrate_mean' &  `mean_c_e_mortrate_mean'   &  `p_diff_tc_e_mortrate_mean' & `p_diff_info_e_mortrate_mean'   &  `p_diff_inter_e_mortrate_mean'   \\
    tex \midrule
	tex \textit{D. Endline levels of intermediate outcome indices} & & & & & & & & \\
	tex \midrule
	tex Citizen knowledge      &  `mean_t_e_ctzknow_mean' & `mean_inf_e_ctzknow_mean'   & `mean_int_e_ctzknow_mean' &  `mean_c_e_ctzknow_mean'   &  `p_diff_tc_e_ctzknow_mean' & `p_diff_info_e_ctzknow_mean'   &  `p_diff_inter_e_ctzknow_mean'   \\
	tex Health worker knowledge      &  `mean_t_e_h_hcpknow_mean' & `mean_inf_e_h_hcpknow_mean'   & `mean_int_e_h_hcpknow_mean' &  `mean_c_e_h_hcpknow_mean'   &  `p_diff_tc_e_h_hcpknow_mean' & `p_diff_info_e_h_hcpknow_mean'   &  `p_diff_inter_e_h_hcpknow_mean'   \\
	tex Efficacy      &  `mean_t_e_eff_mean' & `mean_inf_e_eff_mean'   & `mean_int_e_eff_mean' &  `mean_c_e_eff_mean'   &  `p_diff_tc_e_eff_mean' & `p_diff_info_e_eff_mean'   &  `p_diff_inter_e_eff_mean'   \\
	tex Community responsibility      &  `mean_t_e_commresp_mean' & `mean_inf_e_commresp_mean'   & `mean_int_e_commresp_mean' &  `mean_c_e_commresp_mean'   &  `p_diff_tc_e_commresp_mean' & `p_diff_info_e_commresp_mean'   &  `p_diff_inter_e_commresp_mean'   \\
	tex Community monitoring      &  `mean_t_e_commtg_mean' & `mean_inf_e_commtg_mean'   & `mean_int_e_commtg_mean' &  `mean_c_e_commtg_mean'   &  `p_diff_tc_e_commtg_mean' & `p_diff_info_e_commtg_mean'   &  `p_diff_inter_e_commtg_mean'   \\
	tex Relationship between health workers and community    &  `mean_t_e_relhhhc_mean' & `mean_inf_e_relhhhc_mean'   & `mean_int_e_relhhhc_mean' &  `mean_c_e_relhhhc_mean'   &  `p_diff_tc_e_relhhhc_mean' & `p_diff_info_e_relhhhc_mean'   &  `p_diff_inter_e_relhhhc_mean'   \\
	tex Health center transparency      &  `mean_t_e_h_hctrans_mean' & `mean_inf_e_h_hctrans_mean'   & `mean_int_e_h_hctrans_mean' &  `mean_c_e_h_hctrans_mean'   &  `p_diff_tc_e_h_hctrans_mean' & `p_diff_info_e_h_hctrans_mean'   &  `p_diff_inter_e_h_hctrans_mean'   \\
	tex \midrule
	tex N & `e_n_t' & `e_n_inf' & `e_n_int' & `e_n_c' & & & \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	

	***********************************************************************************************************
	* Figure 9: Plotting p-values from two one-sided tests against lambda for main outcome indices at endline *
	***********************************************************************************************************
	
	eststo clear
	
	* We load the dataset. This is the light version
	
	use "${usedata}/chp_el_light_dataset.dta", clear
	
	* We regress our main indices

	local indices urate_z treatqual_z patsat_z commtg_z
	local indices_hc mortrate_05 h_ctzpressure_z

	
	foreach x in `indices' {
		
		local y = 0

		forvalues i = .001(.001).15 {
		
			local y = `y' + 1
		
			* At endline
			
			areg  e_`x' treatfull b_`x' b_`x'_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district) 
			
			test _b[treatfull] = `i'
			loc pval_plus_`y' `r(p)'

			test _b[treatfull] =  (-1)*`i'
			loc pval_minus_`y' `r(p)'

			if `pval_minus_`y'' >=  `pval_plus_`y'' {
				loc pvale`x'_`y'  `pval_minus_`y''
				}

			if `pval_minus_`y'' <  `pval_plus_`y'' {
				loc pvale`x'_`y'  `pval_plus_`y''
				}
				
			gen pvale`x'_`y' = `pvale`x'_`y''
			
			}
			
		}
		
	* U5M indicator
	
	foreach x in `indices_hc' {
		
		local y = 0

		forvalues i = .001(.001).15 {
		
			local y = `y' + 1
			
			* At endline
			
			areg  e_`x' treatfull b_`x' `e_controls_tfull_hc' ``var'_hc_int_e_controls' if uniquehc == 1, robust a(district)
		
			test _b[treatfull] = `i'
			loc pval_plus_`y' `r(p)'

			test _b[treatfull] =  (-1)*`i'
			loc pval_minus_`y' `r(p)'

			if `pval_minus_`y'' >=  `pval_plus_`y'' {
				loc pvale`x'_`y'  `pval_minus_`y''
				}

			if `pval_minus_`y'' <  `pval_plus_`y'' {
				loc pvale`x'_`y'  `pval_plus_`y''
				}
				
			gen pvale`x'_`y' = `pvale`x'_`y''
			
			}
			
		}
	
	* At endline
	
	keep pvale*
	duplicates drop
	
	gen x = 1
	
	reshape long pvalecommtg_z_ pvaleurate_z_ pvaletreatqual_z_ pvalepatsat_z_  pvalemortrate_05_ pvaleh_ctzpressure_z_, i(x) j(pos)
	
	drop x 
	replace pos = pos/1000
	
	* We create the graph
	
	local indices urate_z treatqual_z patsat_z commtg_z
	local indices_hc mortrate_05 h_ctzpressure_z

	
	foreach x in `indices' {
	
		lab var pvale`x'_ "P-value"
		lab var pos "Lambda"
	
		twoway scatter pvale`x'_ pos, yline(0.05, lp(dash)) scheme(s1mono) mcolor(blue) ytick(0.0(0.2)1.0) ylabel(0.0(0.2)1.0) xtick(.001(.001).15)
		gr export "${Figures}/Figure9_pvale`x'.png", replace
	
		}
		
		
	foreach x in `indices_hc' { 
	
		lab var pvale`x'_ "P-value"
		lab var pvale`x'_ "P-value"
		lab var pos "Lambda"
	
		twoway scatter pvale`x'_ pos, yline(0.05, lp(dash)) scheme(s1mono) mcolor(blue) ytick(0.0(0.2)1.0) ylabel(0.0(0.2)1.0) xtick(.001(.001).15)
		gr export "${Figures}/Figure9_pvale`x'.png", replace
	
		}
		
	* Health outcome
	
	* At endline
	
	use "${usedata}/healthoutcome_endline_ind.dta", clear
	
	local y = 0

	forvalues i = .001(.001).15 {
		
		local y = `y' + 1

		* At endline
		
		areg e_healthoutcome_z treatfull b_healthoutcome_z b_healthoutcome_z_d `e_controls_tfull' ``var'_int_e_controls', robust cl(hc_id) a(district)
	
		test _b[treatfull] = `i'
			loc pval_plus_`y' `r(p)'

		test _b[treatfull] =  (-1)*`i'
			loc pval_minus_`y' `r(p)'

		if `pval_minus_`y'' >=  `pval_plus_`y'' {
			loc pvalehealthoutcome_z_`y'  `pval_minus_`y''
			}

		if `pval_minus_`y'' <  `pval_plus_`y'' {
			loc pvalehealthoutcome_z_`y'  `pval_plus_`y''
			}
			
		gen pvalehealthoutcome_z_`y' = `pvalehealthoutcome_z_`y''
				
		}
		
	* At endline preparing data for graph
	
	keep pvale*
	duplicates drop
	
	gen x = 1
	reshape long pvalehealthoutcome_z_, i(x) j(pos)
	
	drop x 
	replace pos = pos/1000
	
	* We create the graph
	
	foreach x in healthoutcome_z {
	
		lab var pvale`x'_ "P-value"
		lab var pos "Lambda"
	
		twoway scatter pvale`x'_ pos, yline(0.05, lp(dash)) scheme(s1mono) mcolor(blue) ytick(0.0(0.2)1.0) ylabel(0.0(0.2)1.0) xtick(.001(.001).15)
		gr export "${Figures}/Figure9_pvale`x'.png", replace
	
		}
		
	*************************************************
	* Table J1: GOAL attendance and monitoring data *
	*************************************************
	
	* In this section, we will create the GOAL attendance and Assesment tools from Data we manually entered from document share by our partner
	
	* We import the do-file
	
	use "${usedata}/GOAL_attendance_data.dta", clear
	
	* We take care of the treatment arms

	replace treatment = "3" if treatment == "T3 - Interface"
	replace treatment = "2" if treatment == "T2 - Information"
	replace treatment = "1" if treatment == "T1 - Full program"

	destring treatment, replace

	* We implement the table for GOAL statistics we compiled
	
	* Section A. HC information separate dialogue
	
	* # of staff present

	forvalues x = 1/2 {
		sum att_hc_dialogue if treatment == `x'
		local n_1_`x' `r(N)'
		local est_1_`x' = string(`r(mean)',"%9.2fc")
		local sd_1_`x' = string(`r(sd)',"%9.2fc")		
		}


	* % of HC staff present

	* As we have missing data we take the number of staff at baseline for missing values

	preserve

	use "${usedata}/chp_el_light_dataset.dta", clear

	egen b_h_dpercentstaff = anycount(b_h_present*), values(1,2)
	
	keep hc_id b_h_dpercentstaff

	duplicates drop

	tempfile staffpresence
	sa "`staffpresence'"

	restore

	merge 1:1 hc_id using "`staffpresence'"

	drop if _merge != 3
	drop _merge

	replace pct_hc_dialogue =  att_hc_dialogue/b_h_dpercentstaff if pct_hc_dialogue == .

	forvalues x = 1/2 {
		sum pct_hc_dialogue if treatment == `x'
		local n_2_`x' `r(N)'
		local est_2_`x' = string(`r(mean)',"%9.2fc")
		local sd_2_`x' = string(`r(sd)',"%9.2fc")		
		}
	
	* Section B. Community information separate dialogue
	
	* Data has been entered such as we need to sum men and women

	* # of community members present 

	replace att_comm_dialogue = att_comm_dialogue + att_comm_f_dialogue if att_comm_f_dialogue != .

	forvalues x = 1/2 {
		sum att_comm_dialogue if treatment == `x'
		local n_3_`x' `r(N)'
		local est_3_`x' = string(`r(mean)',"%9.2fc")
		local sd_3_`x' = string(`r(sd)',"%9.2fc")		
		}

	* # of female community members present 

	forvalues x = 1/2 {
		sum att_comm_f_dialogue if treatment == `x'
		local n_4_`x' `r(N)'
		local est_4_`x' = string(`r(mean)',"%9.2fc")
		local sd_4_`x' = string(`r(sd)',"%9.2fc")		
		}

	* % of HCs where at least one SC official is present

	gen sc_comm_dialogue_d = 0
	replace sc_comm_dialogue_d = 1 if sc_comm_dialogue == 1
	replace sc_comm_dialogue_d = . if sc_comm_dialogue == .

	forvalues x = 1/2 {
		sum sc_comm_dialogue_d if treatment == `x'
		local n_5_`x' `r(N)'
		local est_5_`x' = string(`r(mean)',"%9.2fc")
		local sd_5_`x' = string(`r(sd)',"%9.2fc")		
		}
		
	* Section C. Interface meeting
	
	* # of community members present 

	forvalues x = 1(2)3 {
		sum com_att_interface if treatment == `x'
		local n_6_`x' `r(N)'
		local est_6_`x' = string(`r(mean)',"%9.2fc")
		local sd_6_`x' = string(`r(sd)',"%9.2fc")		
		}

	* # of female community members present 

	forvalues x = 1(2)3 {
		sum com_att_fem_interface if treatment == `x'
		local n_7_`x' `r(N)'
		local est_7_`x' = string(`r(mean)',"%9.2fc")
		local sd_7_`x' = string(`r(sd)',"%9.2fc")		
		}
	

	* # of HC staff present 

	forvalues x = 1(2)3 {
		sum hc_att_interface if treatment == `x'
		local n_8_`x' `r(N)'
		local est_8_`x' = string(`r(mean)',"%9.2fc")
		local sd_8_`x' = string(`r(sd)',"%9.2fc")		
		}

	* % of HCs where at least one SC official is present

	gen sc_att_interface_d = 0
	replace sc_att_interface_d = 1 if sc_att_interface == 1
	replace sc_att_interface_d = . if sc_att_interface == .

	forvalues x = 1(2)3 {
		sum sc_att_interface_d if treatment == `x'
		local n_9_`x' `r(N)'
		local est_9_`x' = string(`r(mean)',"%9.2fc")
		local sd_9_`x' = string(`r(sd)',"%9.2fc")		
		}
		
	* Section D. Follow-up meetings (average across three meetings)
	
	* We keep 3 meetings as the fourth one was after endline

	* # of community members present 

	* We need to add both men and women attendance

	forvalues x = 1/3 {
		gen attendance_f`x' = com_att_f_interface_`x' if treatment == 1 | treatment == 3
		replace attendance_f`x' = attendance_f`x' + com_att_f_fem_interface_`x' if treatment == 1 & com_att_f_fem_interface_`x' != . | treatment == 3 & com_att_f_fem_interface_`x' != .
		replace attendance_f`x' = com_att_f_comm_`x' if treatment == 2	
		replace attendance_f`x' = com_att_f_comm_`x' + com_att_f_fem_comm_`x' if treatment == 2 & com_att_f_fem_comm_`x' != .
		}
	
	egen attendance_fup = rowmean(attendance_f1 attendance_f2 attendance_f3)

	forvalues x = 1/3 {
		sum attendance_fup if treatment == `x'
		local n_10_`x' `r(N)'
		local est_10_`x' = string(`r(mean)',"%9.2fc")
		local sd_10_`x' = string(`r(sd)',"%9.2fc")		
		}

	* # of female community members present 

	forvalues x = 1/3 {
		gen attendance_fem_f`x' = com_att_f_fem_interface_`x' if treatment == 1 | treatment == 3
		replace attendance_fem_f`x' = com_att_f_fem_comm_`x' if treatment == 2
		}
	
	egen attendance_fem_fup = rowmean(attendance_fem_f1 attendance_fem_f2 attendance_fem_f3)

	forvalues x = 1/3 {
		sum attendance_fem_fup if treatment == `x'
		local n_11_`x' `r(N)'
		local est_11_`x' = string(`r(mean)',"%9.2fc")
		local sd_11_`x' = string(`r(sd)',"%9.2fc")		
		}

	* # of HC staff present 

	forvalues x = 1/3 {	
		gen attendance_hc_f`x' = hc_att_f_interface_`x' if treatment == 1 | treatment == 3
		replace attendance_hc_f`x' = com_att_f_hc_`x' if treatment == 2
		}
	
	egen attendance_hc_fup = rowmean(attendance_hc_f1 attendance_hc_f2 attendance_hc_f3)

	forvalues x = 1/3 {
		sum attendance_hc_fup if treatment == `x'
		local n_12_`x' `r(N)'
		local est_12_`x' = string(`r(mean)',"%9.2fc")
		local sd_12_`x' = string(`r(sd)',"%9.2fc")		
		}

	* % of HCs where at least one SC official is present

	* We don't have value for info only

	forvalues x = 1/3 {
		gen attendance_sc_f`x' = sc_att_f_interface_`x' if treatment == 1 | treatment == 3
		}
	
	egen attendance_sc_fup = rowmean(attendance_sc_f1 attendance_sc_f2 attendance_sc_f3)

	forvalues x = 1(2)3 {
		sum attendance_sc_fup if treatment == `x'
		local n_13_`x' `r(N)'
		local est_13_`x' = string(`r(mean)',"%9.2fc")
		local sd_13_`x' = string(`r(sd)',"%9.2fc")		
		}
	
	* Section E. Supervision/Assesment tools
	
	* We import the relevant excel file

	use "${usedata}/GOAL_assesment_tool.dta", clear

	replace treatment = "3" if treatment == "T3 - Interface"
	replace treatment = "2" if treatment == "T2 - Information"
	replace treatment = "1" if treatment == "T1 - Full program"

	destring treatment, replace


	* % supervision during the initial activity

	forvalues x = 1/3 {
		sum initial_activity if treatment == `x'
		local n_14_`x' `r(N)'
		local est_14_`x' = string(`r(mean)',"%9.2fc")
		local sd_14_`x' = string(`r(sd)',"%9.2fc")		
		}

	* % supervision during at least one follow-up meeting

	egen total_fu = rowtotal(fu_1 fu_2 fu_3)

	gen fu1 = 0 if total_fu < 1 & total_fu != .
	replace fu1 = 1 if total_fu >= 1 & total_fu != .

	forvalues x = 1/3 {
		sum fu1 if treatment == `x'
		local n_15_`x' `r(N)'
		local est_15_`x' = string(`r(mean)',"%9.2fc")
		local sd_15_`x' = string(`r(sd)',"%9.2fc")		
		}

	* % supervision at least one time (initial activity or follow-up)

	egen total_ifu = rowtotal(initial_activity fu_1 fu_2 fu_3)

	gen inita_fu = 0 if total_ifu < 1 & total_ifu != .
	replace inita_fu = 1 if total_ifu >= 1 & total_ifu != .

	forvalues x = 1/3 {
		sum inita_fu if treatment == `x'
		local n_16_`x' `r(N)'
		local est_16_`x' = string(`r(mean)',"%9.2fc")
		local sd_16_`x' = string(`r(sd)',"%9.2fc")		
		}
		
	
	texdoc init "${tables}/TableJ1.tex", replace force
	tex \begin{landscape}
	tex \begin{table}[htbp]\centering
	tex \footnotesize
	tex \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
	tex \caption{GOAL attendance and monitoring data}
	tex \begin{tabular}{lccccccccl}
	tex \toprule
	tex 										  & \multicolumn{3}{c}{Full treatment}                      & \multicolumn{3}{c}{Information only}                                                          & \multicolumn{3}{c}{Interface only}                     \\
	tex											  & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{Mean} & \multicolumn{1}{c}{SD} & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{Mean} & \multicolumn{1}{c}{SD} & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{Mean} & \multicolumn{1}{c}{SD} \\
	tex \midrule
	tex \textit{\textbf{Section A. HC information separate dialogue}} \\
	tex \# of HC staff present  & `n_1_1' & `est_1_1' & `sd_1_1' & `n_1_2' & `est_1_2' & `sd_1_2' & X & X & X \\
	tex \% of HC staff present   & `n_2_1' & `est_2_1' & `sd_2_1' & `n_2_2' & `est_2_2' & `sd_2_2' & X & X & X \\
	tex \textit{\textbf{Section B. Community information separate dialogue}} \\
	tex \# of community members present   & `n_3_1' & `est_3_1' & `sd_3_1' & `n_3_2' & `est_3_2' & `sd_3_2' & X & X & X \\
	tex \# of female community members present    & `n_4_1' & `est_4_1' & `sd_4_1' & `n_4_2' & `est_4_2' & `sd_4_2' & X & X & X \\
	tex \% of HCs where at least one SC official is present    & `n_5_1' & `est_5_1' & `sd_5_1' & `n_5_2' & `est_5_2' & `sd_5_2' & X & X & X \\
	tex \textit{\textbf{Section C. Interface meeting}} \\
	tex \# of community members present   & `n_6_1' & `est_6_1' & `sd_6_1' & X & X & X & `n_6_3' & `est_6_3' & `sd_6_3' \\
	tex \# of female community members present     & `n_7_1' & `est_7_1' & `sd_7_1' & X & X & X & `n_7_3' & `est_7_3' & `sd_7_3' \\
	tex \# of HC staff present     & `n_8_1' & `est_8_1' & `sd_8_1' & X & X & X & `n_8_3' & `est_8_3' & `sd_8_3' \\
	tex \% of HCs where at least one SC official is present & `n_9_1' & `est_9_1' & `sd_9_1' & X & X & X & `n_9_3' & `est_9_3' & `sd_9_3' \\
	tex \textit{\textbf{Section D. Follow-up meetings (average across three meetings)}} \\
	tex \# of community members present   & `n_10_1' & `est_10_1' & `sd_10_1' & `n_10_2' & `est_10_2' & `sd_10_2' & `n_10_3' & `est_10_3' & `sd_10_3' \\
	tex \# of female community members present    & `n_11_1' & `est_11_1' & `sd_11_1' & `n_11_2' & `est_11_2' & `sd_11_2' & `n_11_3' & `est_11_3' & `sd_11_3' \\
	tex \# of HC staff present     & `n_12_1' & `est_12_1' & `sd_12_1' & `n_12_2' & `est_12_2' & `sd_12_2' & `n_12_3' & `est_12_3' & `sd_12_3' \\
	tex \% of HCs where at least one SC official is present & `n_13_1' & `est_13_1' & `sd_13_1' & `n_13_2' & `est_13_2' & `sd_13_2' & `n_13_3' & `est_13_3' & `sd_13_3' \\
	tex \textit{\textbf{Section E. Supervision/Assesment tools}} \\
	tex \% supervision during the initial activity   & `n_14_1' & `est_14_1' & `sd_14_1' & `n_14_2' & `est_14_2' & `sd_14_2' & `n_14_3' & `est_14_3' & `sd_14_3' \\
	tex \% supervision during at least one follow-up meeting    & `n_15_1' & `est_15_1' & `sd_15_1' & `n_15_2' & `est_15_2' & `sd_15_2' & `n_15_3' & `est_15_3' & `sd_15_3' \\
	tex \% supervision at least one time (initial activity or follow-up) & `n_16_1' & `est_16_1' & `sd_16_1' & `n_16_2' & `est_16_2' & `sd_16_2' & `n_16_3' & `est_16_3' & `sd_16_3' \\
	tex \bottomrule
	tex \end{tabular}
	tex \end{table}
	texdoc close
	
